//
// Crash Site
//

#include "stagesetup.h"

// Characters
enum chrnum {
	CHR_ELVIS,
	CHR_TRENT,
#if VERSION >= VERSION_NTSC_1_0
	CHR_TRENT_OUTRO,
#endif
	CHR_MRBLONDE,
	CHR_SKEDAR,
	CHR_PRESIDENT,
	CHR_PRESIDENT_OUTRO,
	CHR_07,
	CHR_PRES_CLONE,
	CHR_09,
	CHR_0A,
	CHR_0B,
	CHR_0C,
	CHR_0D,
	CHR_0E,
	CHR_0F,
	CHR_10,
	CHR_11,
	CHR_12,
	CHR_13,
	CHR_14,
	CHR_15,
	CHR_16,
	CHR_17,
	CHR_18,
	CHR_19,
	CHR_1A,
	CHR_1B,
	CHR_1C,
	CHR_1D,
	CHR_1E,
	CHR_1F,
	CHR_20,
	CHR_21,
	CHR_22,
	CHR_23,
	CHR_24,
	CHR_25,
	CHR_ROBOT1,
	CHR_ROBOT2,
	CHR_ROBOT3,
	CHR_ROBOT4,
	CHR_2A,
	CHR_2B,
	CHR_2C,
	CHR_2D,
	CHR_2E,
	CHR_2F,
	CHR_30,
	CHR_31,
	CHR_32,
	CHR_33,
	CHR_34,
	CHR_35,
	CHR_36,
	CHR_37,
	CHR_ELVIS_OUTRO
};

// Objects
#define OBJ_CRATE          0x00
#define OBJ_ESCAPEPOD      0x01
#define OBJ_MEDICALSCANNER 0x02
#define OBJ_SKEDAR_SHUTTLE 0x03
#define OBJ_PROXYMINE      0x08
#define OBJ_HOVERBIKE      0x09

// Stage flags
#define STAGEFLAG_BEACON_ACTIVATED          0x00000100
#define STAGEFLAG_ESCAPEPOD_DESTROYED       0x00000200
#define STAGEFLAG_SKEDAR_SHUTTLE_DESTROYED  0x00000400
#define STAGEFLAG_PRESIDENT_DEAD            0x00000800
#define STAGEFLAG_PRESIDENT_RESCUED         0x00001000
#define STAGEFLAG_CLONE_DEAD                0x00002000
#define STAGEFLAG_TRIGGER_PRESIDENT_RUNNING 0x00004000
#define STAGEFLAG_TRENT_RUNNING             0x00008000
#define STAGEFLAG_ELVIS_GAVE_PROXYMINE      0x00010000
#define STAGEFLAG_OUTRO_STARTED             0x00020000

// AI Lists
#define AILIST_OUTRO               0x0402
#define AILIST_INIT_ELVIS          0x0403
#define AILIST_ELVIS               0x0404
#define AILIST_INIT_STRIPES        0x0406
#define AILIST_INIT_BLONDE         0x0407
#define AILIST_SPAWNER             0x0414
#define AILIST_SPAWNED_GUARD       0x0416
#define AILIST_INIT_ROBOT          0x0417
#define AILIST_ROBOT               0x0418
#define AILIST_INIT_PRESIDENT      0x041b
#define AILIST_PRESIDENT_WAITING   0x041c
#define AILIST_PRESIDENT_RUNNING   0x041d
#define AILIST_TRENT_WAITING       0x041e
#define AILIST_TRENT_SHOOTING      0x041f
#define AILIST_TRENT_RUNNING       0x0420
#define AILIST_STARTING_AREA_GUARD 0x0421
#define AILIST_HIDE                0x0422

extern s32 intro[];
extern u32 props[];
extern struct path paths[];
extern struct ailist ailists[];

struct stagesetup setup = {
	NULL,
	NULL,
	NULL,
	intro,
	props,
	paths,
	ailists,
	NULL,
};

u32 props[] = {
	briefing(BRIEFINGTYPE_LOCATION, L_AZT_001)
	briefing(BRIEFINGTYPE_TEXT_PA,  L_AZT_000)
	briefing(BRIEFINGTYPE_TEXT_SA,  L_AZT_002)
	briefing(BRIEFINGTYPE_TEXT_A,   L_AZT_003)

	beginobjective(0, L_AZT_005, (DIFFBIT_SA | DIFFBIT_PA | DIFFBIT_PD)) // "Retrieve Presidential medical scanner"
		require_object_collected(OBJ_MEDICALSCANNER)
	endobjective

	beginobjective(1, L_AZT_006, (DIFFBIT_A | DIFFBIT_SA | DIFFBIT_PA | DIFFBIT_PD)) // "Activate distress beacon"
		complete_flags(STAGEFLAG_BEACON_ACTIVATED)
		fail_flags(STAGEFLAG_ESCAPEPOD_DESTROYED)
	endobjective

	beginobjective(2, L_AZT_007, (DIFFBIT_PA | DIFFBIT_PD)) // "Shut down enemy jamming device"
		complete_flags(STAGEFLAG_SKEDAR_SHUTTLE_DESTROYED)
	endobjective

	beginobjective(3, L_AZT_008, (DIFFBIT_A | DIFFBIT_SA | DIFFBIT_PA | DIFFBIT_PD)) // "Retire Presidential clone"
		complete_flags(STAGEFLAG_CLONE_DEAD)
	endobjective

	beginobjective(4, L_AZT_009, (DIFFBIT_A | DIFFBIT_SA | DIFFBIT_PA | DIFFBIT_PD)) // "Locate and rescue President"
		complete_flags(STAGEFLAG_PRESIDENT_RESCUED)
		fail_flags(STAGEFLAG_PRESIDENT_DEAD)
	endobjective

	tag(0x09, 1)
	hoverbike(0x0100, MODEL_HOVBIKE, PAD_AZT_0000, OBJFLAG_FALL | OBJFLAG_00000100 | OBJFLAG_INVINCIBLE | OBJFLAG_UNCOLLECTABLE | OBJFLAG_01000000 | OBJFLAG_AISEETHROUGH, OBJFLAG2_NOFALL | OBJFLAG2_FALLWITHOUTROTATION | OBJFLAG2_IMMUNETOGUNFIRE | OBJFLAG2_BULLETPROOF | OBJFLAG2_IMMUNETOEXPLOSIONS, OBJFLAG3_PUSHABLE | OBJFLAG3_GRABBABLE | OBJFLAG3_GEOCYL, 1000)
	chr(SPAWNFLAG_ANTINONINTERACTABLE | SPAWNFLAG_BLUESIGHT, CHR_ELVIS, PAD_AZT_0106, BODY_THEKING, HEAD_ELVIS, AILIST_INIT_ELVIS, -1, -1, 1000, 200, CHRFLAG0_SKIPSAFETYCHECKS, CHRFLAG1_AIVSAI_ADVANTAGED | CHRFLAG1_NOOP_00200000, TEAM_ALLY, SQUADRON_01, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRMAIANPISTOL, CHR_ELVIS, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_PHOENIX)
#if VERSION >= VERSION_NTSC_1_0
	chr(SPAWNFLAG_ANTINONINTERACTABLE | SPAWNFLAG_BLUESIGHT, CHR_ELVIS_OUTRO, PAD_AZT_011F, BODY_THEKING, HEAD_ELVIS, AILIST_HIDE, -1, -1, 1000, 200, CHRFLAG0_SKIPSAFETYCHECKS, CHRFLAG1_AIVSAI_ADVANTAGED | CHRFLAG1_NOOP_00200000, TEAM_NONCOMBAT, SQUADRON_01, -1, 0, 0, 0, 0, 0)
#else
	chr(SPAWNFLAG_ANTINONINTERACTABLE | SPAWNFLAG_BLUESIGHT, CHR_ELVIS_OUTRO, PAD_AZT_011F, BODY_THEKING, HEAD_ELVIS, AILIST_HIDE, -1, -1, 1000, 200, CHRFLAG0_SKIPSAFETYCHECKS, CHRFLAG1_AIVSAI_ADVANTAGED | CHRFLAG1_NOOP_00200000, TEAM_ALLY, SQUADRON_01, -1, 0, 0, 0, 0, 0)
#endif
	weapon(0x0100, MODEL_CHRMAIANPISTOL, CHR_ELVIS_OUTRO, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_PHOENIX)
#if VERSION >= VERSION_NTSC_1_0
	chr(SPAWNFLAG_ANTINONINTERACTABLE | SPAWNFLAG_BLUESIGHT, CHR_PRESIDENT_OUTRO, PAD_AZT_0110, BODY_PRESIDENT, HEAD_PRESIDENT, AILIST_HIDE, -1, -1, 1000, 200, CHRFLAG0_SKIPSAFETYCHECKS, CHRFLAG1_AIVSAI_ADVANTAGED | CHRFLAG1_NOOP_00200000, TEAM_NONCOMBAT, SQUADRON_01, -1, 0, 0, 0, 0, 0)
	chr(SPAWNFLAG_ANTINONINTERACTABLE, CHR_TRENT_OUTRO, PAD_AZT_010E, BODY_TRENT, HEAD_TRENT, AILIST_HIDE, -1, -1, 1000, 200, CHRFLAG0_SKIPSAFETYCHECKS | CHRFLAG0_CANLOSEGUN, CHRFLAG1_AIVSAI_ADVANTAGED | CHRFLAG1_NOOP_00200000, TEAM_NONCOMBAT, SQUADRON_08, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRDY357TRENT, CHR_TRENT_OUTRO, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_DY357LX)
#else
	chr(SPAWNFLAG_ANTINONINTERACTABLE | SPAWNFLAG_BLUESIGHT, CHR_PRESIDENT_OUTRO, PAD_AZT_0110, BODY_PRESIDENT, HEAD_PRESIDENT, AILIST_HIDE, -1, -1, 1000, 200, CHRFLAG0_SKIPSAFETYCHECKS, CHRFLAG1_AIVSAI_ADVANTAGED | CHRFLAG1_NOOP_00200000, TEAM_ALLY, SQUADRON_01, -1, 0, 0, 0, 0, 0)
#endif
	chr(SPAWNFLAG_BASICGUARD, CHR_09, PAD_AZT_005A, BODY_STRIPES, HEAD_RANDOM, 0x0408, -1, -1, 100, 13, CHRFLAG0_SKIPSAFETYCHECKS | CHRFLAG0_SQUADALERTANYDIST | CHRFLAG0_HEAR_REQUIRE_LOS | CHRFLAG0_CANLOSEGUN, 0, TEAM_ENEMY, SQUADRON_01, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRAVENGER, CHR_09, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_K7AVENGER)
	chr(SPAWNFLAG_BASICGUARD, CHR_0A, PAD_AZT_0059, BODY_STRIPES, HEAD_RANDOM, 0x0408, -1, -1, 100, 13, CHRFLAG0_SKIPSAFETYCHECKS | CHRFLAG0_SQUADALERTANYDIST | CHRFLAG0_HEAR_REQUIRE_LOS | CHRFLAG0_CANLOSEGUN, 0, TEAM_ENEMY, SQUADRON_01, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRAVENGER, CHR_0A, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_K7AVENGER)
	chr(SPAWNFLAG_BASICGUARD, CHR_0B, PAD_AZT_0058, BODY_MRBLONDE, HEAD_MRBLONDE, 0x0408, -1, -1, 100, 13, CHRFLAG0_SKIPSAFETYCHECKS | CHRFLAG0_SQUADALERTANYDIST | CHRFLAG0_HEAR_REQUIRE_LOS | CHRFLAG0_CANLOSEGUN, CHRFLAG1_CAN_SNIPE, TEAM_ENEMY, SQUADRON_01, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRSNIPERRIFLE, CHR_0B, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_SNIPERRIFLE)
	chr(SPAWNFLAG_BASICGUARD, CHR_0C, PAD_AZT_00D1, BODY_STRIPES, HEAD_RANDOM, 0x0409, -1, -1, 100, 13, CHRFLAG0_SKIPSAFETYCHECKS | CHRFLAG0_SQUADALERTANYDIST | CHRFLAG0_HEAR_REQUIRE_LOS | CHRFLAG0_CANLOSEGUN, 0, TEAM_ENEMY, SQUADRON_02, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRAVENGER, CHR_0C, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_K7AVENGER)
	chr(SPAWNFLAG_BASICGUARD, CHR_0D, PAD_AZT_00D4, BODY_STRIPES, HEAD_RANDOM, 0x0409, -1, -1, 100, 13, CHRFLAG0_SKIPSAFETYCHECKS | CHRFLAG0_SQUADALERTANYDIST | CHRFLAG0_HEAR_REQUIRE_LOS | CHRFLAG0_CANLOSEGUN, 0, TEAM_ENEMY, SQUADRON_02, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRAVENGER, CHR_0D, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_K7AVENGER)
	chr(SPAWNFLAG_BASICGUARD, CHR_0E, PAD_AZT_00D5, BODY_MRBLONDE, HEAD_MRBLONDE, 0x0409, -1, -1, 100, 13, CHRFLAG0_SKIPSAFETYCHECKS | CHRFLAG0_SQUADALERTANYDIST | CHRFLAG0_HEAR_REQUIRE_LOS | CHRFLAG0_CANLOSEGUN, CHRFLAG1_CAN_SNIPE, TEAM_ENEMY, SQUADRON_02, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRSNIPERRIFLE, CHR_0E, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_SNIPERRIFLE)
	chr(SPAWNFLAG_BASICGUARD, CHR_13, PAD_AZT_004C, BODY_STRIPES, HEAD_RANDOM, 0x040a, -1, -1, 100, 13, CHRFLAG0_SKIPSAFETYCHECKS | CHRFLAG0_SQUADALERTANYDIST | CHRFLAG0_CAN_HEARSPAWN | CHRFLAG0_HEAR_REQUIRE_LOS | CHRFLAG0_CANLOSEGUN, 0, TEAM_ENEMY, SQUADRON_03, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRAVENGER, CHR_13, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_K7AVENGER)
	chr(SPAWNFLAG_BASICGUARD, CHR_14, PAD_AZT_005F, BODY_STRIPES, HEAD_RANDOM, 0x040b, -1, -1, 100, 13, CHRFLAG0_SKIPSAFETYCHECKS | CHRFLAG0_SQUADALERTANYDIST | CHRFLAG0_HEAR_REQUIRE_LOS | CHRFLAG0_CANLOSEGUN, 0, TEAM_ENEMY, SQUADRON_03, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRAVENGER, CHR_14, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_K7AVENGER)
	chr(SPAWNFLAG_BASICGUARD, CHR_15, PAD_AZT_004D, BODY_STRIPES, HEAD_RANDOM, 0x040c, -1, -1, 100, 13, CHRFLAG0_SKIPSAFETYCHECKS | CHRFLAG0_SQUADALERTANYDIST | CHRFLAG0_CAN_HEARSPAWN | CHRFLAG0_HEAR_REQUIRE_LOS | CHRFLAG0_CANLOSEGUN, 0, TEAM_ENEMY, SQUADRON_03, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRAVENGER, CHR_15, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_K7AVENGER)
	chr(SPAWNFLAG_BASICGUARD, CHR_16, PAD_AZT_0055, BODY_STRIPES, HEAD_RANDOM, 0x040d, -1, -1, 100, 13, CHRFLAG0_SKIPSAFETYCHECKS | CHRFLAG0_SQUADALERTANYDIST | CHRFLAG0_HEAR_REQUIRE_LOS | CHRFLAG0_CANLOSEGUN, 0, TEAM_ENEMY, SQUADRON_03, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRAVENGER, CHR_16, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_K7AVENGER)
	chr(SPAWNFLAG_BASICGUARD, CHR_17, PAD_AZT_0081, BODY_STRIPES, HEAD_RANDOM, AILIST_INIT_STRIPES, -1, -1, 100, 13, CHRFLAG0_SKIPSAFETYCHECKS | CHRFLAG0_SQUADALERTANYDIST | CHRFLAG0_CAN_HEARSPAWN | CHRFLAG0_HEAR_REQUIRE_LOS | CHRFLAG0_CANLOSEGUN, 0, TEAM_ENEMY, SQUADRON_04, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRAVENGER, CHR_17, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_K7AVENGER)
	chr(SPAWNFLAG_BASICGUARD, CHR_18, PAD_AZT_0079, BODY_STRIPES, HEAD_RANDOM, AILIST_INIT_STRIPES, -1, -1, 100, 13, CHRFLAG0_SKIPSAFETYCHECKS | CHRFLAG0_SQUADALERTANYDIST | CHRFLAG0_HEAR_REQUIRE_LOS | CHRFLAG0_CANLOSEGUN, 0, TEAM_ENEMY, SQUADRON_04, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRAVENGER, CHR_18, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_K7AVENGER)
	chr(SPAWNFLAG_BASICGUARD, CHR_19, PAD_AZT_007B, BODY_STRIPES, HEAD_RANDOM, AILIST_INIT_STRIPES, -1, -1, 100, 13, CHRFLAG0_SKIPSAFETYCHECKS | CHRFLAG0_SQUADALERTANYDIST | CHRFLAG0_CAN_HEARSPAWN | CHRFLAG0_HEAR_REQUIRE_LOS | CHRFLAG0_CANLOSEGUN, 0, TEAM_ENEMY, SQUADRON_04, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRAVENGER, CHR_19, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_K7AVENGER)
	chr(SPAWNFLAG_BASICGUARD, CHR_1A, PAD_AZT_007C, BODY_STRIPES, HEAD_RANDOM, AILIST_INIT_STRIPES, -1, -1, 100, 13, CHRFLAG0_SKIPSAFETYCHECKS | CHRFLAG0_SQUADALERTANYDIST | CHRFLAG0_HEAR_REQUIRE_LOS | CHRFLAG0_CANLOSEGUN, 0, TEAM_ENEMY, SQUADRON_04, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRAVENGER, CHR_1A, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_K7AVENGER)
	chr(SPAWNFLAG_BASICGUARD, CHR_1B, PAD_AZT_016B, BODY_STRIPES, HEAD_RANDOM, 0x040e, -1, -1, 100, 13, CHRFLAG0_SKIPSAFETYCHECKS | CHRFLAG0_SQUADALERTANYDIST | CHRFLAG0_CAN_HEARSPAWN | CHRFLAG0_HEAR_REQUIRE_LOS | CHRFLAG0_CANLOSEGUN, 0, TEAM_ENEMY, SQUADRON_05, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRAVENGER, CHR_1B, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_K7AVENGER)
	chr(SPAWNFLAG_BASICGUARD, CHR_1C, PAD_AZT_016C, BODY_STRIPES, HEAD_RANDOM, 0x040f, -1, -1, 100, 13, CHRFLAG0_SKIPSAFETYCHECKS | CHRFLAG0_SQUADALERTANYDIST | CHRFLAG0_HEAR_REQUIRE_LOS | CHRFLAG0_CANLOSEGUN, 0, TEAM_ENEMY, SQUADRON_05, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRAVENGER, CHR_1C, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_K7AVENGER)
	chr(SPAWNFLAG_BASICGUARD, CHR_1D, PAD_AZT_0048, BODY_STRIPES, HEAD_RANDOM, 0x0410, -1, -1, 100, 13, CHRFLAG0_SKIPSAFETYCHECKS | CHRFLAG0_SQUADALERTANYDIST | CHRFLAG0_CAN_HEARSPAWN | CHRFLAG0_HEAR_REQUIRE_LOS | CHRFLAG0_CANLOSEGUN, 0, TEAM_ENEMY, SQUADRON_06, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRAVENGER, CHR_1D, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_K7AVENGER)
	chr(SPAWNFLAG_BASICGUARD, CHR_1E, PAD_AZT_017E, BODY_STRIPES, HEAD_RANDOM, 0x0411, -1, -1, 100, 13, CHRFLAG0_SKIPSAFETYCHECKS | CHRFLAG0_SQUADALERTANYDIST | CHRFLAG0_HEAR_REQUIRE_LOS | CHRFLAG0_CANLOSEGUN, 0, TEAM_ENEMY, SQUADRON_06, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRAVENGER, CHR_1E, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_K7AVENGER)
	chr(SPAWNFLAG_BASICGUARD, CHR_1F, PAD_AZT_0177, BODY_STRIPES, HEAD_RANDOM, 0x0412, -1, -1, 100, 13, CHRFLAG0_SKIPSAFETYCHECKS | CHRFLAG0_SQUADALERTANYDIST | CHRFLAG0_CAN_HEARSPAWN | CHRFLAG0_HEAR_REQUIRE_LOS | CHRFLAG0_CANLOSEGUN, 0, TEAM_ENEMY, SQUADRON_07, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRAVENGER, CHR_1F, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_K7AVENGER)
	chr(SPAWNFLAG_BASICGUARD, CHR_20, PAD_AZT_0189, BODY_STRIPES, HEAD_RANDOM, 0x0413, -1, -1, 100, 13, CHRFLAG0_SKIPSAFETYCHECKS | CHRFLAG0_SQUADALERTANYDIST | CHRFLAG0_HEAR_REQUIRE_LOS | CHRFLAG0_CANLOSEGUN, 0, TEAM_ENEMY, SQUADRON_07, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRAVENGER, CHR_20, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_K7AVENGER)
	chr(0, CHR_ROBOT1, PAD_AZT_01BB, BODY_CHICROB, 0x00, AILIST_INIT_ROBOT, -1, -1, 1000, 50, CHRFLAG0_SQUADALERTANYDIST, 0, TEAM_ENEMY, SQUADRON_08, -1, 0, 0, 0, 0, 0)
	chr(0, CHR_ROBOT2, PAD_AZT_01BC, BODY_CHICROB, 0x00, AILIST_INIT_ROBOT, -1, -1, 1000, 50, CHRFLAG0_SQUADALERTANYDIST, 0, TEAM_ENEMY, SQUADRON_08, -1, 0, 0, 0, 0, 0)
	chr(0, CHR_ROBOT3, PAD_AZT_01BD, BODY_CHICROB, 0x00, AILIST_INIT_ROBOT, -1, -1, 1000, 50, CHRFLAG0_SQUADALERTANYDIST, 0, TEAM_ENEMY, SQUADRON_08, -1, 0, 0, 0, 0, 0)
	chr(0, CHR_ROBOT4, PAD_AZT_01BE, BODY_CHICROB, 0x00, AILIST_INIT_ROBOT, -1, -1, 1000, 50, CHRFLAG0_SQUADALERTANYDIST, 0, TEAM_ENEMY, SQUADRON_08, -1, 0, 0, 0, 0, 0)
	chr(SPAWNFLAG_ANTINONINTERACTABLE, CHR_TRENT, PAD_AZT_01B5, BODY_TRENT, HEAD_TRENT, AILIST_TRENT_WAITING, -1, -1, 1000, 200, CHRFLAG0_SKIPSAFETYCHECKS | CHRFLAG0_CANLOSEGUN, CHRFLAG1_AIVSAI_ADVANTAGED | CHRFLAG1_NOOP_00200000, TEAM_ENEMY, SQUADRON_08, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRDY357TRENT, CHR_TRENT, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_DY357LX)
	chr(SPAWNFLAG_ANTINONINTERACTABLE | SPAWNFLAG_RTRACKED | SPAWNFLAG_BLUESIGHT, CHR_PRESIDENT, PAD_AZT_01B6, BODY_PRESIDENT, HEAD_PRESIDENT, AILIST_INIT_PRESIDENT, -1, -1, 1000, 200, CHRFLAG0_SKIPSAFETYCHECKS, CHRFLAG1_AIVSAI_ADVANTAGED | CHRFLAG1_NOOP_00200000, TEAM_ALLY, SQUADRON_01, -1, 0, 0, 0, 0, 0)
	chr(SPAWNFLAG_ANTINONINTERACTABLE | SPAWNFLAG_RTRACKED, CHR_PRES_CLONE, PAD_AZT_0086, BODY_PRESIDENT_CLONE2, HEAD_PRESIDENT, 0x041a, -1, -1, 1000, 20, CHRFLAG0_SKIPSAFETYCHECKS, CHRFLAG1_AIVSAI_ADVANTAGED | CHRFLAG1_NOOP_00200000, TEAM_ENEMY, SQUADRON_09, -1, 0, 2, 0, 20, 0)
	chr(SPAWNFLAG_BASICGUARD, CHR_2A, PAD_AZT_0088, BODY_MRBLONDE, HEAD_MRBLONDE, AILIST_INIT_BLONDE, -1, -1, 1000, 100, CHRFLAG0_CAN_EXAMINE_BODY | CHRFLAG0_CAN_RETREAT | CHRFLAG0_SURPRISABLE | CHRFLAG0_FORCESAFETYCHECKS | CHRFLAG0_CANLOSEGUN, CHRFLAG1_ADJUSTPUNCHSPEED | CHRFLAG1_LONG_CAMSPY_OBSERVATION, TEAM_ENEMY, SQUADRON_09, -1, 0, 2, 0, 20, 0)
	weapon(0x0100, MODEL_CHRAVENGER, CHR_2A, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_K7AVENGER)
	chr(SPAWNFLAG_BASICGUARD, CHR_2B, PAD_AZT_0087, BODY_MRBLONDE, HEAD_MRBLONDE, AILIST_INIT_BLONDE, -1, -1, 1000, 100, CHRFLAG0_CAN_EXAMINE_BODY | CHRFLAG0_CAN_RETREAT | CHRFLAG0_SURPRISABLE | CHRFLAG0_FORCESAFETYCHECKS | CHRFLAG0_CANLOSEGUN, CHRFLAG1_ADJUSTPUNCHSPEED | CHRFLAG1_LONG_CAMSPY_OBSERVATION, TEAM_ENEMY, SQUADRON_09, -1, 0, 2, 0, 20, 0)
	weapon(0x0100, MODEL_CHRAVENGER, CHR_2B, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_K7AVENGER)
	chr(SPAWNFLAG_BASICGUARD, CHR_2C, PAD_AZT_0085, BODY_MRBLONDE, HEAD_MRBLONDE, AILIST_INIT_BLONDE, -1, -1, 1000, 100, CHRFLAG0_CAN_EXAMINE_BODY | CHRFLAG0_CAN_RETREAT | CHRFLAG0_SURPRISABLE | CHRFLAG0_FORCESAFETYCHECKS | CHRFLAG0_CANLOSEGUN, CHRFLAG1_ADJUSTPUNCHSPEED | CHRFLAG1_LONG_CAMSPY_OBSERVATION, TEAM_ENEMY, SQUADRON_09, -1, 0, 2, 0, 20, 0)
	weapon(0x0100, MODEL_CHRAVENGER, CHR_2C, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_K7AVENGER)
	chr(SPAWNFLAG_BASICGUARD, CHR_2D, PAD_AZT_019E, BODY_MRBLONDE, HEAD_MRBLONDE, AILIST_INIT_BLONDE, -1, -1, 1000, 100, CHRFLAG0_CAN_EXAMINE_BODY | CHRFLAG0_CAN_RETREAT | CHRFLAG0_SURPRISABLE | CHRFLAG0_FORCESAFETYCHECKS | CHRFLAG0_CANLOSEGUN, CHRFLAG1_ADJUSTPUNCHSPEED | CHRFLAG1_LONG_CAMSPY_OBSERVATION, TEAM_ENEMY, SQUADRON_0A, -1, 0, 2, 0, 20, 0)
	weapon(0x0100, MODEL_CHRAVENGER, CHR_2D, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_K7AVENGER)
	chr(SPAWNFLAG_BASICGUARD, CHR_2E, PAD_AZT_018E, BODY_MRBLONDE, HEAD_MRBLONDE, AILIST_INIT_BLONDE, -1, -1, 1000, 100, CHRFLAG0_CAN_EXAMINE_BODY | CHRFLAG0_CAN_RETREAT | CHRFLAG0_SURPRISABLE | CHRFLAG0_FORCESAFETYCHECKS | CHRFLAG0_CANLOSEGUN, CHRFLAG1_ADJUSTPUNCHSPEED | CHRFLAG1_LONG_CAMSPY_OBSERVATION, TEAM_ENEMY, SQUADRON_0A, -1, 0, 2, 0, 20, 0)
	weapon(0x0100, MODEL_CHRAVENGER, CHR_2E, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_K7AVENGER)
	chr(SPAWNFLAG_BASICGUARD, CHR_2F, PAD_AZT_01A7, BODY_MRBLONDE, HEAD_MRBLONDE, AILIST_INIT_BLONDE, -1, -1, 1000, 100, CHRFLAG0_CAN_EXAMINE_BODY | CHRFLAG0_CAN_RETREAT | CHRFLAG0_SURPRISABLE | CHRFLAG0_FORCESAFETYCHECKS | CHRFLAG0_CANLOSEGUN, CHRFLAG1_ADJUSTPUNCHSPEED | CHRFLAG1_LONG_CAMSPY_OBSERVATION, TEAM_ENEMY, SQUADRON_0A, -1, 0, 2, 0, 20, 0)
	weapon(0x0100, MODEL_CHRAVENGER, CHR_2F, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_K7AVENGER)
	chr(0, CHR_30, PAD_AZT_002D, BODY_STRIPES, HEAD_RANDOM, AILIST_SPAWNER, -1, -1, 100, 13, CHRFLAG0_SKIPSAFETYCHECKS | CHRFLAG0_SQUADALERTANYDIST | CHRFLAG0_CAN_HEARSPAWN | CHRFLAG0_HEAR_REQUIRE_LOS | CHRFLAG0_CANLOSEGUN, 0, TEAM_ENEMY, SQUADRON_0B, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRAVENGER, CHR_30, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_K7AVENGER)
	chr(0, CHR_31, PAD_AZT_0029, BODY_STRIPES, HEAD_RANDOM, AILIST_SPAWNER, -1, -1, 100, 13, CHRFLAG0_SKIPSAFETYCHECKS | CHRFLAG0_SQUADALERTANYDIST | CHRFLAG0_CAN_HEARSPAWN | CHRFLAG0_HEAR_REQUIRE_LOS | CHRFLAG0_CANLOSEGUN, 0, TEAM_ENEMY, SQUADRON_0B, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRAVENGER, CHR_31, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_K7AVENGER)
	chr(SPAWNFLAG_BASICGUARD, CHR_32, PAD_AZT_009A, BODY_STRIPES, HEAD_RANDOM, AILIST_STARTING_AREA_GUARD, -1, -1, 100, 13, CHRFLAG0_SKIPSAFETYCHECKS | CHRFLAG0_SQUADALERTANYDIST | CHRFLAG0_HEAR_REQUIRE_LOS | CHRFLAG0_CANLOSEGUN, CHRFLAG1_SEARCHSAMEROOM, TEAM_ENEMY, SQUADRON_0C, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRAVENGER, CHR_32, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_K7AVENGER)
	chr(SPAWNFLAG_BASICGUARD, CHR_33, PAD_AZT_009B, BODY_STRIPES, HEAD_RANDOM, AILIST_STARTING_AREA_GUARD, -1, -1, 100, 13, CHRFLAG0_SKIPSAFETYCHECKS | CHRFLAG0_SQUADALERTANYDIST | CHRFLAG0_HEAR_REQUIRE_LOS | CHRFLAG0_CANLOSEGUN, CHRFLAG1_SEARCHSAMEROOM, TEAM_ENEMY, SQUADRON_0C, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRAVENGER, CHR_33, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_K7AVENGER)
	chr(SPAWNFLAG_BASICGUARD, CHR_34, PAD_AZT_01B7, BODY_MRBLONDE, HEAD_MRBLONDE, AILIST_STARTING_AREA_GUARD, -1, -1, 100, 13, CHRFLAG0_SKIPSAFETYCHECKS | CHRFLAG0_SQUADALERTANYDIST | CHRFLAG0_HEAR_REQUIRE_LOS | CHRFLAG0_CANLOSEGUN, CHRFLAG1_SEARCHSAMEROOM, TEAM_ENEMY, SQUADRON_0C, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRSNIPERRIFLE, CHR_34, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_SNIPERRIFLE)
#if VERSION >= VERSION_NTSC_1_0
	chr(SPAWNFLAG_BASICGUARD, CHR_35, PAD_AZT_0004, BODY_STRIPES, HEAD_RANDOM, AILIST_STARTING_AREA_GUARD, -1, -1, 100, 13, CHRFLAG0_SKIPSAFETYCHECKS | CHRFLAG0_SQUADALERTANYDIST | CHRFLAG0_CANLOSEGUN, CHRFLAG1_SEARCHSAMEROOM, TEAM_ENEMY, SQUADRON_0D, -1, 0, 0, 0, 0, 0)
#else
	chr(SPAWNFLAG_BASICGUARD, CHR_35, PAD_AZT_01B8, BODY_STRIPES, HEAD_RANDOM, AILIST_STARTING_AREA_GUARD, -1, -1, 100, 13, CHRFLAG0_SKIPSAFETYCHECKS | CHRFLAG0_SQUADALERTANYDIST | CHRFLAG0_CANLOSEGUN | CHRFLAG0_HEAR_REQUIRE_LOS, CHRFLAG1_SEARCHSAMEROOM, TEAM_ENEMY, SQUADRON_0D, -1, 0, 0, 0, 0, 0)
#endif
	weapon(0x0100, MODEL_CHRAVENGER, CHR_35, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_K7AVENGER)
	chr(SPAWNFLAG_BASICGUARD, CHR_36, PAD_AZT_01B9, BODY_STRIPES, HEAD_RANDOM, AILIST_STARTING_AREA_GUARD, -1, -1, 100, 13, CHRFLAG0_CANT_ALERT_GROUP | CHRFLAG0_CAN_BACKOFF | CHRFLAG0_SKIPSAFETYCHECKS | CHRFLAG0_SQUADALERTANYDIST | CHRFLAG0_CANLOSEGUN, CHRFLAG1_SEARCHSAMEROOM, TEAM_ENEMY, SQUADRON_0D, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRAVENGER, CHR_36, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_K7AVENGER)
#if VERSION >= VERSION_NTSC_1_0
	chr(SPAWNFLAG_BASICGUARD, CHR_37, PAD_AZT_0012, BODY_MRBLONDE, HEAD_MRBLONDE, AILIST_STARTING_AREA_GUARD, -1, -1, 100, 13, CHRFLAG0_SKIPSAFETYCHECKS | CHRFLAG0_SQUADALERTANYDIST | CHRFLAG0_CANLOSEGUN, CHRFLAG1_SEARCHSAMEROOM, TEAM_ENEMY, SQUADRON_0D, -1, 0, 0, 0, 0, 0)
#else
	chr(SPAWNFLAG_BASICGUARD, CHR_37, PAD_AZT_01BA, BODY_MRBLONDE, HEAD_MRBLONDE, AILIST_STARTING_AREA_GUARD, -1, -1, 100, 13, CHRFLAG0_SKIPSAFETYCHECKS | CHRFLAG0_SQUADALERTANYDIST | CHRFLAG0_CANLOSEGUN | CHRFLAG0_HEAR_REQUIRE_LOS, CHRFLAG1_SEARCHSAMEROOM, TEAM_ENEMY, SQUADRON_0D, -1, 0, 0, 0, 0, 0)
#endif
	weapon(0x0100, MODEL_CHRSNIPERRIFLE, CHR_37, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_SNIPERRIFLE)
	chr(0, CHR_MRBLONDE, PAD_AZT_0121, BODY_MRBLONDE, HEAD_MRBLONDE, AILIST_HIDE, -1, -1, 1000, 200, CHRFLAG0_SKIPSAFETYCHECKS, CHRFLAG1_AIVSAI_ADVANTAGED | CHRFLAG1_NOOP_00200000, TEAM_ENEMY, SQUADRON_01, -1, 0, 0, 0, 0, 0)
	chr(SPAWNFLAG_FIXEDHEIGHT, CHR_SKEDAR, PAD_AZT_012F, BODY_SKEDAR, 0x00, AILIST_HIDE, -1, -1, 1000, 200, CHRFLAG0_SKIPSAFETYCHECKS, CHRFLAG1_AIVSAI_ADVANTAGED | CHRFLAG1_NOOP_00200000, TEAM_ENEMY, SQUADRON_01, -1, 0, 0, 0, 0, 0)
	tag(0x00, 1)
	stdobject(0x0100, MODEL_A51_CRATE1, -1, OBJFLAG_FALL | OBJFLAG_00000100 | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_IGNOREROOMCOLOUR | OBJFLAG_INVINCIBLE, 0, 0, 1000)
	tag(0x01, 1)
	stdobject(0x0100, MODEL_PRESCAPSULE, PAD_AZT_01D8, OBJFLAG_FALL | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_00000100, OBJFLAG2_IMMUNETOANTI | OBJFLAG2_NOFALL, OBJFLAG3_INTERACTABLE, 12000)
	tag(0x03, 1)
	stdobject(0x0100, MODEL_SK_SHUTTLE, -1, OBJFLAG_FALL | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_00000100, OBJFLAG2_NOFALL | OBJFLAG2_REMOVEWHENDESTROYED, 0, 12500)
	tag(0x02, 1)
	weapon(0x0180, MODEL_CHRBRIEFCASE, PAD_AZT_000C, OBJFLAG_FALL, OBJFLAG2_IMMUNETOANTI, OBJFLAG3_PLAYERUNDROPPABLE, WEAPON_PRESIDENTSCANNER)
	autogun(0x0100, MODEL_GROUNDGUN, PAD_AZT_0043, OBJFLAG_FALL, 0, 0, 4000, 0x003d, 0x00020000, 0xfffe0000, 0x0000016c, 0x001e0000)
	autogun(0x0100, MODEL_GROUNDGUN, PAD_AZT_003B, OBJFLAG_FALL, 0, 0, 4000, 0x0038, 0x00020000, 0xfffe0000, 0x0000016c, 0x001e0000)
	tag(0x06, 1)
	shield(0x0100, MODEL_CHRSHIELD, PAD_AZT_0106, OBJFLAG_FALL, OBJFLAG2_EXCLUDE_SA | OBJFLAG2_EXCLUDE_PA | OBJFLAG2_EXCLUDE_PD, 0, 1000)
	tag(0x07, 1)
	shield(0x0100, MODEL_CHRSHIELD, PAD_AZT_0090, OBJFLAG_FALL, OBJFLAG2_EXCLUDE_PA | OBJFLAG2_EXCLUDE_PD, 0, 1000)
	tag(0x08, 1)
#if VERSION >= VERSION_NTSC_1_0
	weapon(0x0100, MODEL_MULTI_AMMO_CRATE, PAD_AZT_0106, OBJFLAG_FALL | OBJFLAG_INVINCIBLE | OBJFLAG_UNCOLLECTABLE, OBJFLAG2_IMMUNETOANTI | OBJFLAG2_INVISIBLE, 0, WEAPON_PROXIMITYMINE)
#else
	weapon(0x0100, MODEL_MULTI_AMMO_CRATE, PAD_AZT_000C, OBJFLAG_FALL | OBJFLAG_INVINCIBLE | OBJFLAG_UNCOLLECTABLE, OBJFLAG2_IMMUNETOANTI | OBJFLAG2_INVISIBLE, 0, WEAPON_PROXIMITYMINE)
#endif
	pad_effect(PADEFFECT_SPARKS, 0x000001db)
	pad_effect(PADEFFECT_SMOKE, 0x000001dc)
	pad_effect(PADEFFECT_SPARKS, 0x000001dd)
	pad_effect(PADEFFECT_SPARKS, 0x000001de)
	endprops
};

s32 intro[] = {
	outfit(OUTFIT_SNOW)
	intro_weapon(WEAPON_FALCON2_SCOPE, -1)
	ammo(AMMOTYPE_PISTOL, 50)
	ammo(AMMOTYPE_RIFLE, 100)
	intro_weapon(WEAPON_REMOTEMINE, -1)
	ammo(AMMOTYPE_REMOTE_MINE, 3)
	intro_weapon(WEAPON_NIGHTVISION, -1)
	intro_weapon(WEAPON_HORIZONSCANNER, -1)
	spawn(PAD_AZT_00B8)
	endintro
};

s32 path00[] = {
	PAD_AZT_0059,
	PAD_AZT_0096,
	PAD_AZT_0095,
	PAD_AZT_0094,
	PAD_AZT_00BE,
	PAD_AZT_00BD,
	PAD_AZT_009E,
	-1,
};

s32 path01[] = {
	PAD_AZT_00D1,
	PAD_AZT_00D2,
	PAD_AZT_00D3,
	PAD_AZT_00B1,
	PAD_AZT_00CD,
	PAD_AZT_00A6,
	PAD_AZT_00B3,
	PAD_AZT_00C3,
	-1,
};

s32 path02[] = {
	PAD_AZT_004C,
	PAD_AZT_0057,
	PAD_AZT_005E,
	PAD_AZT_005D,
	PAD_AZT_005B,
	PAD_AZT_005F,
	-1,
};

s32 path03[] = {
	PAD_AZT_005F,
	PAD_AZT_005B,
	PAD_AZT_005C,
	PAD_AZT_005D,
	PAD_AZT_0066,
	PAD_AZT_005D,
	PAD_AZT_005C,
	PAD_AZT_005B,
	-1,
};

s32 path04[] = {
	PAD_AZT_004D,
	PAD_AZT_0051,
	PAD_AZT_0050,
	PAD_AZT_0053,
	PAD_AZT_0054,
	PAD_AZT_0056,
	PAD_AZT_006E,
	-1,
};

s32 path05[] = {
	PAD_AZT_0055,
	PAD_AZT_0052,
	PAD_AZT_0054,
	PAD_AZT_0056,
	PAD_AZT_006E,
	-1,
};

s32 path06[] = {
	PAD_AZT_0030,
	PAD_AZT_002F,
	PAD_AZT_0167,
	PAD_AZT_0166,
	PAD_AZT_0165,
	PAD_AZT_0164,
	PAD_AZT_016A,
	PAD_AZT_0169,
	PAD_AZT_016B,
	-1,
};

s32 path07[] = {
	PAD_AZT_016C,
	PAD_AZT_016D,
	PAD_AZT_016E,
	PAD_AZT_016F,
	PAD_AZT_0170,
	PAD_AZT_0171,
	PAD_AZT_0172,
	PAD_AZT_0173,
	-1,
};

s32 path08[] = {
	PAD_AZT_0048,
	PAD_AZT_0049,
	PAD_AZT_004A,
	PAD_AZT_0182,
	PAD_AZT_0183,
	PAD_AZT_0180,
	PAD_AZT_0181,
	-1,
};

s32 path09[] = {
	PAD_AZT_017E,
	PAD_AZT_017F,
	PAD_AZT_017B,
	PAD_AZT_017C,
	PAD_AZT_017D,
	PAD_AZT_0034,
	-1,
};

s32 path10[] = {
	PAD_AZT_0177,
	PAD_AZT_0175,
	PAD_AZT_0176,
	PAD_AZT_0189,
	-1,
};

s32 path11[] = {
	PAD_AZT_0189,
	PAD_AZT_0188,
	PAD_AZT_0187,
	PAD_AZT_0186,
	PAD_AZT_0185,
	PAD_AZT_0184,
	-1,
};

s32 path12[] = {
	PAD_AZT_0106,
	PAD_AZT_0107,
	PAD_AZT_00F6,
	PAD_AZT_0104,
	-1,
};

struct path paths[] = {
	{ path00, 0, 0 },
	{ path01, 1, 0 },
	{ path02, 2, 0 },
	{ path03, 3, 0 },
	{ path04, 4, 0 },
	{ path05, 5, 0 },
	{ path06, 6, 0 },
	{ path07, 7, 0 },
	{ path08, 8, 0 },
	{ path09, 9, 0 },
	{ path10, 10, 0 },
	{ path11, 11, 0 },
	{ path12, 12, 0 },
	{ NULL, 0, 0 },
};

u8 func1001_objectives_failed_msg[] = {
	yield
	set_chr_chrflag(CHR_PRES_CLONE, CHRCFLAG_KEEPCORPSEKO)
	set_chr_chrflag(CHR_ELVIS, CHRCFLAG_KEEPCORPSEKO)
	set_chr_chrflag(CHR_PRESIDENT, CHRCFLAG_KEEPCORPSEKO)
	set_ailist(CHR_SELF, GAILIST_SHOW_OBJ_FAILED_MSG)
	endlist
};

u8 func1400_setup_counterop[] = {
	yield
	set_chr_team(CHR_ANTI, TEAM_ENEMY)
	set_ailist(CHR_SELF, GAILIST_REBUILD_GROUPS)
	endlist
};

u8 func1011_setup_snow[] = {
	enable_snow(TRUE)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func1002_intro[] = {
	set_chr_chrflag(CHR_COOP, CHRCFLAG_HIDDEN)
	set_chr_chrflag(CHR_ANTI, CHRCFLAG_HIDDEN)
	play_cutscene_track(MUSIC_CRASHSITE_INTRO)
	camera_movement(ANIM_CUT_AZT_INTRO_CAM)
	cmd0175(60)

	set_chr_chrflag(CHR_BOND, CHRCFLAG_UNPLAYABLE)
	set_chr_hiddenflag(CHR_BOND, CHRHFLAG_00020000)
	chr_do_animation(ANIM_CUT_AZT_INTRO_JO, -1, -1, CHRANIMFLAG_MOVEWHENINVIS | CHRANIMFLAG_PAUSEATEND, 0, CHR_BOND, 4)
	set_chr_hudpiece_visible(CHR_BOND, TRUE)

	restart_timer
	fade_to_color(0x000000ff, 0)
	fade_to_color(0x00000000, 300)
	set_cutscene_weapon(CHR_BOND, WEAPON_NONE, WEAPON_NONE)
	yield
	set_cutscene_weapon(CHR_BOND, WEAPON_NONE, WEAPON_NONE)

	#define wait_until(time, loopid) \
		beginloop(loopid) \
			if_controller_button_pressed(/*goto*/ 0x65) \
			if_timer_gt(time, /*goto*/ 0x08) \
		endloop(loopid) \
		label(0x08)

	wait_until(724, 0x69)
	speak(CHR_BOND, L_AZT_032, MP3_0759, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "Ahhh... uuhhhh..."

	wait_until(830, 0x6a)
	speak(CHR_BOND, L_AZT_034, MP3_0457, CHANNEL_CUTSCENE, COLOR_06_WHITE) // "Agent Dark! Please report!"

	wait_until(980, 0x6b)
	speak(CHR_BOND, L_AZT_033, MP3_075A, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "Ahhh... uhh... owww..."

	wait_until(1030, 0x6c)
	speak(CHR_BOND, L_AZT_035, MP3_0458, CHANNEL_CUTSCENE, COLOR_06_WHITE) // "Perfect Dark, come in!"

	wait_until(1152, 0x6e)
	speak(CHR_BOND, L_AZT_036, MP3_0459, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "A-agent Dark reporting in..."

	wait_until(1372, 0x6f)
	speak(CHR_BOND, L_AZT_037, MP3_045A, CHANNEL_CUTSCENE, COLOR_06_WHITE) // "Agent Dark! Please reply!"

	wait_until(1610, 0x6d)
	speak(CHR_BOND, L_AZT_038, MP3_045B, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "Something's jamming my transmissions... It's comin..."

	wait_until(1875, 0x70)
	speak(CHR_BOND, -1, SFX_FOOTSTEP_8189, CHANNEL_CUTSCENE, COLOR_00_GREEN)

	wait_until(1900, 0x71)
	speak(CHR_BOND, -1, SFX_FOOTSTEP_818A, CHANNEL_CUTSCENE, COLOR_00_GREEN)

	wait_until(1926, 0x72)
	speak(CHR_BOND, -1, SFX_FOOTSTEP_8188, CHANNEL_7, COLOR_00_GREEN)

	wait_until(1958, 0x73)
	speak(CHR_BOND, -1, SFX_FOOTSTEP_8189, CHANNEL_CUTSCENE, COLOR_00_GREEN)

	wait_until(2000, 0x74)
	speak(CHR_BOND, L_AZT_039, MP3_045C, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "I'd better find the jamming device and check that ..."

	wait_until(2116, 0x75)
	speak(CHR_BOND, -1, SFX_FOOTSTEP_8188, CHANNEL_7, COLOR_00_GREEN)

	wait_until(2168, 0x76)
	speak(CHR_BOND, -1, SFX_FOOTSTEP_8187, CHANNEL_6, COLOR_00_GREEN)

	wait_until(2224, 0x78)
	set_cutscene_weapon(CHR_BOND, WEAPON_NONE, WEAPON_NONE)
	yield
	set_cutscene_weapon(CHR_BOND, WEAPON_FALCON2_SCOPE, WEAPON_NONE)

	wait_until(2305, 0x79)
	speak(CHR_BOND, -1, SFX_01DB, CHANNEL_5, COLOR_00_GREEN)

	wait_until(2392, 0x7a)
	speak(CHR_BOND, -1, SFX_FOOTSTEP_8189, CHANNEL_7, COLOR_00_GREEN)

	wait_until(2412, 0x7b)
	speak(CHR_BOND, -1, SFX_FOOTSTEP_8187, CHANNEL_6, COLOR_00_GREEN)

	wait_until(2460, 0x7c)
	speak(CHR_BOND, -1, SFX_FOOTSTEP_8188, CHANNEL_7, COLOR_00_GREEN)

	wait_until(2513, 0x7d)
	speak(CHR_BOND, -1, SFX_FOOTSTEP_8189, CHANNEL_6, COLOR_00_GREEN)

	wait_until(2685, 0x7e)
	speak(CHR_BOND, -1, SFX_FOOTSTEP_818A, CHANNEL_7, COLOR_00_GREEN)

	beginloop(0x0a)
		if_camera_animating(/*goto*/ 0x31)
		goto_next(0x65)

		label(0x31)
		if_controller_button_pressed(/*goto*/ 0x65)
		label(0x31)
	endloop(0x0a)

	label(0x65)
	set_cutscene_weapon(CHR_BOND, WEAPON_NONE, WEAPON_NONE)
	yield
	set_cutscene_weapon(CHR_BOND, WEAPON_FALCON2_SCOPE, WEAPON_NONE)
	mute_channel(CHANNEL_7)
	mute_channel(CHANNEL_6)
	mute_channel(CHANNEL_5)
	mute_channel(CHANNEL_CUTSCENE)
	unset_chr_chrflag(CHR_COOP, CHRCFLAG_HIDDEN)
	unset_chr_chrflag(CHR_ANTI, CHRCFLAG_HIDDEN)
	unset_chr_chrflag(CHR_BOND, CHRCFLAG_UNPLAYABLE)
	set_chr_hiddenflag(CHR_BOND, CHRHFLAG_00020000)
	chr_do_animation(ANIM_CUT_AZT_INTRO_JO, -2, -1, CHRANIMFLAG_MOVEWHENINVIS | CHRANIMFLAG_PAUSEATEND, 0, CHR_BOND, 2)
	stop_cutscene_track
	stop_ambient_track
	set_chr_hudpiece_visible(CHR_BOND, FALSE)
	enter_firstperson
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func0402_outro_from_menu[] = {
	set_ailist(CHR_PRESIDENT_OUTRO, GAILIST_IDLE)
	set_ailist(CHR_MRBLONDE, GAILIST_IDLE)
	set_ailist(CHR_SKEDAR, GAILIST_IDLE)
	set_ailist(CHR_ELVIS_OUTRO, GAILIST_IDLE)
#if VERSION >= VERSION_NTSC_FINAL
	set_ailist(CHR_TRENT_OUTRO, GAILIST_IDLE)
#endif
	disable_chr(CHR_ROBOT1)
	disable_chr(CHR_ROBOT2)
	disable_chr(CHR_ROBOT3)
	disable_chr(CHR_ROBOT4)
	set_ailist(CHR_SELF, AILIST_OUTRO)
	endlist
};

u8 func0402_outro[] = {
	set_stage_flag(STAGEFLAG_OUTRO_STARTED)
	disable_object(OBJ_HOVERBIKE)
	set_ailist(CHR_PRESIDENT, GAILIST_IDLE)
	if_chr_death_animation_finished(CHR_BOND, /*goto*/ 0x31)
	set_target_chr(CHR_BOND)
	goto_next(0x08)
	label(0x31)
	set_target_chr(CHR_COOP)
	label(0x08)
	camera_movement(ANIM_CUT_AZT_OUTRO_CAM)
	play_cutscene_track(MUSIC_CRASHSITE_OUTRO)
	set_chr_chrflag(CHR_ANTI, CHRCFLAG_HIDDEN)
	set_chr_chrflag(CHR_P1P2_OPPOSITE, CHRCFLAG_HIDDEN)
	set_chr_chrflag(CHR_P1P2, CHRCFLAG_HIDDEN)
	unset_chr_chrflag(CHR_TARGET, CHRCFLAG_HIDDEN)
	set_ailist(CHR_TARGET, GAILIST_IDLE)

	remove_chr(CHR_ELVIS)
	set_ailist(CHR_ELVIS, GAILIST_IDLE)

	set_chr_chrflag(CHR_PRESIDENT, CHRCFLAG_HIDDEN)
	set_chr_chrflag(CHR_PRESIDENT, CHRCFLAG_INVINCIBLE)
	set_ailist(CHR_PRESIDENT, GAILIST_IDLE)

	set_chr_chrflag(CHR_TARGET, CHRCFLAG_UNPLAYABLE)
#if VERSION >= VERSION_NTSC_1_0
	unset_chr_chrflag(CHR_TARGET, CHRCFLAG_HIDDEN)
#endif
	set_chr_hiddenflag(CHR_TARGET, CHRHFLAG_00020000)
	chr_do_animation(ANIM_CUT_AZT_OUTRO_JO, -1, -1, CHRANIMFLAG_MOVEWHENINVIS | CHRANIMFLAG_PAUSEATEND, 0, CHR_TARGET, 4)

	set_chr_chrflag(CHR_SKEDAR, CHRCFLAG_UNPLAYABLE)
	unset_chr_chrflag(CHR_SKEDAR, CHRCFLAG_HIDDEN)
	set_chr_hiddenflag(CHR_SKEDAR, CHRHFLAG_00020000)
	chr_do_animation(ANIM_CUT_AZT_OUTRO_SKEDAR, -1, -1, CHRANIMFLAG_MOVEWHENINVIS | CHRANIMFLAG_PAUSEATEND, 0, CHR_SKEDAR, 4)

	set_chr_chrflag(CHR_ELVIS_OUTRO, CHRCFLAG_INVINCIBLE)
	set_chr_chrflag(CHR_ELVIS_OUTRO, CHRCFLAG_UNPLAYABLE)
	unset_chr_chrflag(CHR_ELVIS_OUTRO, CHRCFLAG_HIDDEN)
	set_chr_hiddenflag(CHR_ELVIS_OUTRO, CHRHFLAG_00020000)
	chr_do_animation(ANIM_CUT_AZT_OUTRO_ELVIS, -1, -1, CHRANIMFLAG_MOVEWHENINVIS | CHRANIMFLAG_PAUSEATEND, 0, CHR_ELVIS_OUTRO, 4)

#if VERSION >= VERSION_NTSC_1_0
	set_chr_chrflag(CHR_TRENT_OUTRO, CHRCFLAG_INVINCIBLE)
	set_chr_chrflag(CHR_TRENT_OUTRO, CHRCFLAG_UNPLAYABLE)
	unset_chr_chrflag(CHR_TRENT_OUTRO, CHRCFLAG_HIDDEN)
	set_chr_hiddenflag(CHR_TRENT_OUTRO, CHRHFLAG_00020000)
	chr_do_animation(ANIM_CUT_AZT_OUTRO_TRENT, -1, -1, CHRANIMFLAG_MOVEWHENINVIS | CHRANIMFLAG_PAUSEATEND, 0, CHR_TRENT_OUTRO, 4)
#else
	set_chr_chrflag(CHR_TRENT, CHRCFLAG_INVINCIBLE)
	set_chr_chrflag(CHR_TRENT, CHRCFLAG_UNPLAYABLE)
	unset_chr_chrflag(CHR_TRENT, CHRCFLAG_HIDDEN)
	set_chr_hiddenflag(CHR_TRENT, CHRHFLAG_00020000)
	chr_do_animation(ANIM_CUT_AZT_OUTRO_TRENT, -1, -1, CHRANIMFLAG_MOVEWHENINVIS | CHRANIMFLAG_PAUSEATEND, 0, CHR_TRENT, 4)
#endif

	set_chr_chrflag(CHR_MRBLONDE, CHRCFLAG_INVINCIBLE)
	set_chr_chrflag(CHR_MRBLONDE, CHRCFLAG_UNPLAYABLE)
	unset_chr_chrflag(CHR_MRBLONDE, CHRCFLAG_HIDDEN)
	set_chr_hiddenflag(CHR_MRBLONDE, CHRHFLAG_00020000)
	chr_do_animation(ANIM_CUT_AZT_OUTRO_MRB, -1, -1, CHRANIMFLAG_MOVEWHENINVIS | CHRANIMFLAG_PAUSEATEND, 0, CHR_MRBLONDE, 4)

	set_chr_chrflag(CHR_PRESIDENT_OUTRO, CHRCFLAG_INVINCIBLE)
	set_chr_chrflag(CHR_PRESIDENT_OUTRO, CHRCFLAG_UNPLAYABLE)
	unset_chr_chrflag(CHR_PRESIDENT_OUTRO, CHRCFLAG_HIDDEN)
	set_chr_hiddenflag(CHR_PRESIDENT_OUTRO, CHRHFLAG_00020000)
	chr_do_animation(ANIM_CUT_AZT_OUTRO_PRES, -1, -1, CHRANIMFLAG_MOVEWHENINVIS | CHRANIMFLAG_PAUSEATEND, 0, CHR_PRESIDENT_OUTRO, 4)

	enable_object(0x00)
	set_object_flag2(OBJ_CRATE, OBJFLAG2_CANFILLVIEWPORT)
	set_object_flag3(OBJ_CRATE, OBJFLAG3_00000010)
	object_do_animation(ANIM_CUT_AZT_OUTRO_CRATE, OBJ_CRATE, 0x04, 0xffff)
	restart_timer
	set_cutscene_weapon(CHR_TARGET, WEAPON_NONE, WEAPON_NONE)
	yield
	set_cutscene_weapon(CHR_TARGET, WEAPON_NONE, WEAPON_NONE)
	set_cutscene_weapon(CHR_ELVIS_OUTRO, WEAPON_NONE, WEAPON_NONE)
	yield
	set_cutscene_weapon(CHR_ELVIS_OUTRO, WEAPON_HAMMER, WEAPON_NONE)
	show_nonessential_chrs(FALSE)

	wait_until(146, 0x69)
	play_sound(SFX_0594, CHANNEL_7)

	wait_until(200, 0x6a)
	play_sound(SFX_0595, CHANNEL_6)

	wait_until(248, 0x6b)
	speak(CHR_BOND, L_AZT_040, MP3_045D, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "How are you feeling, Mr. President?"

	wait_until(414, 0x6c)
	speak(CHR_BOND, L_AZT_041, MP3_045E, CHANNEL_CUTSCENE, COLOR_08_RED) // "Better now, young lady. Today, I think, will take ..."

	wait_until(490, 0x6e)
	play_sound(SFX_0596, CHANNEL_5)

	wait_until(526, 0x6f)
	play_sound(SFX_0597, CHANNEL_7)

	wait_until(578, 0x6d)
	play_sound(SFX_0427, CHANNEL_6)

	wait_until(1078, 0x71)
	play_sound(SFX_0596, CHANNEL_5)

	wait_until(1116, 0x72)
	play_sound(SFX_0597, CHANNEL_7)

	wait_until(1200, 0x70)
	speak(CHR_BOND, L_AZT_042, MP3_045F, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "Just one thing, sir? What is the Pelagic II that T..."

	wait_until(1474, 0x74)
	play_sound(SFX_ELVIS_HEHE, CHANNEL_5)
	play_sound(SFX_00F8, CHANNEL_CUTSCENE)

	wait_until(1490, 0x75)
	play_sound(SFX_0596, CHANNEL_7)

	wait_until(1492, 0x76)
	play_sound(SFX_0594, CHANNEL_6)

	wait_until(1556, 0x77)
	play_sound(SFX_00F8, CHANNEL_CUTSCENE)

	wait_until(1626, 0x73)
	speak(CHR_BOND, L_AZT_043, MP3_0460, CHANNEL_CUTSCENE, COLOR_08_RED) // "It's a U.S. government deep sea research vessel, o..."

	wait_until(1807, 0x79)
	play_sound(SFX_0595, CHANNEL_7)

	wait_until(1850, 0x7a)
	play_sound(SFX_0597, CHANNEL_6)

	wait_until(1872, 0x7c)
	play_sound(SFX_0595, CHANNEL_7)

	wait_until(2074, 0x7d)
	play_sound(SFX_0594, CHANNEL_6)

	wait_until(2270, 0x7e)
	play_sound(SFX_0596, CHANNEL_5)

	wait_until(2286, 0x7f)
	play_sound(SFX_FOOTSTEP_818A, CHANNEL_7)

	wait_until(2296, 0x80)
	play_sound(SFX_FOOTSTEP_8189, CHANNEL_6)

	wait_until(2316, 0x81)
	play_sound(SFX_FOOTSTEP_8187, CHANNEL_5)

	wait_until(2335, 0x82)
	play_sound(SFX_FOOTSTEP_8188, CHANNEL_7)

	wait_until(2450, 0x7b)
	speak(CHR_BOND, L_AZT_044, MP3_0461, CHANNEL_CUTSCENE, COLOR_09_BLUE) // "Trent has a lot to answer for, but I don't think w..."

	wait_until(3150, 0x83)
	speak(CHR_BOND, L_AZT_045, MP3_0462, CHANNEL_CUTSCENE, COLOR_03_RED) // "You have failed, Easton. You are a flawed device, ..."

	wait_until(3380, 0x88)
	play_sound(SFX_FOOTSTEP_818A, CHANNEL_7)

	wait_until(3580, 0x87)
	speak(CHR_BOND, L_AZT_046, MP3_0463, CHANNEL_CUTSCENE, COLOR_05_GREEN) // "Just try it, you Scandinavian freak!"

	wait_until(3747, 0x84)
	play_sound(SFX_FOOTSTEP_8189, CHANNEL_5)

	wait_until(3875, 0x85)
	play_sound(SFX_FOOTSTEP_8188, CHANNEL_7)

	wait_until(4054, 0x86)
	play_sound(SFX_05A0, CHANNEL_5)
	play_sound(SFX_CLOAK_OFF, CHANNEL_CUTSCENE)
	set_chr_hiddenflag(CHR_MRBLONDE, CHRHFLAG_CLOAKED)
	set_chr_hiddenflag(CHR_SKEDAR, CHRHFLAG_CLOAKED)

	wait_until(4100, 0x95)
	unset_chr_hiddenflag(CHR_SKEDAR, CHRHFLAG_CLOAKED)
	play_sound(SFX_SKEDAR_ROAR_052A, CHANNEL_CUTSCENE)

	wait_until(4200, 0x78)
	speak(CHR_BOND, L_AZT_047, MP3_0464, CHANNEL_CUTSCENE, COLOR_05_GREEN) // "Noooooooo!!!"

	wait_until(4240, 0x93)
	play_sound(SFX_05C0, CHANNEL_CUTSCENE)

	wait_until(4296, 0x89)
	play_sound(SFX_007D, CHANNEL_6)

	wait_until(4444, 0x8a)
	play_sound(SFX_05A0, CHANNEL_5)
	play_sound(SFX_SKEDAR_ROAR_0530, CHANNEL_CUTSCENE)

	wait_until(4506, 0x8b)
	play_sound(SFX_05A1, CHANNEL_7)

	wait_until(4544, 0x96)
	set_chr_hiddenflag(CHR_SKEDAR, CHRHFLAG_CLOAKED)

	wait_until(4566, 0x8c)
	play_sound(SFX_CLOAK_ON, CHANNEL_CUTSCENE)
	unset_chr_hiddenflag(CHR_MRBLONDE, CHRHFLAG_CLOAKED)

	wait_until(4576, 0x8d)

	wait_until(4622, 0x8e)
	play_sound(SFX_FOOTSTEP_8187, CHANNEL_7)

	wait_until(4678, 0x8f)
	play_sound(SFX_FOOTSTEP_8188, CHANNEL_7)

	wait_until(4752, 0x90)
	play_sound(SFX_FOOTSTEP_8189, CHANNEL_7)

	beginloop(0x0a)
		if_camera_animating(/*goto*/ 0x31)
		goto_next(0x65)

		label(0x31)
		if_controller_button_pressed(/*goto*/ 0x65)
		label(0x31)
	endloop(0x0a)

	label(0x65)
	end_level
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func0407_init_blonde[] = {
	set_accuracy(20)
	set_reaction_speed(55)
	set_chr_maxdamage(CHR_SELF, 40)
	add_health_or_armor(60)
	set_recovery_speed(0)
	set_shield(0)
	set_ailist(CHR_SELF, GAILIST_UNALERTED)
	endlist
};

u8 func0406_init_stripes[] = {
	set_chr_dodge_rating(2, 10)
	set_accuracy(16)
	set_reaction_speed(55)
	set_chr_maxdamage(CHR_SELF, 60)
	add_health_or_armor(0)
	set_recovery_speed(30)
	set_shield(0)
	set_ailist(CHR_SELF, GAILIST_UNALERTED)
	endlist
};

u8 func1003_msg_therestheescapepod[] = {
	beginloop(0x06)
		chr_toggle_p1p2(CHR_SELF)
		if_chr_distance_to_pad_lt(CHR_P1P2, 1000, PAD_AZT_01D8, /*goto*/ 0x31)
	endloop(0x06)

	label(0x31)
	speak(CHR_P1P2, L_AZT_010, MP3_03CC, CHANNEL_6, COLOR_09_BLUE) // "There's the escape pod."
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func1004_msg_maybetheresabeacon[] = {
	restart_timer
	beginloop(0x06)
	endloop(0x06)

	// Unreachable
	label(0x31)
	speak(CHR_BOND, L_AZT_011, MP3_03CD, CHANNEL_6, COLOR_09_BLUE) // "Maybe there's a beacon in there."
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func1005_msg_thejamming[] = {
#if VERSION >= VERSION_NTSC_1_0
	if_difficulty_lt(DIFF_PA, /*goto*/ 0x0f)
#endif

	beginloop(0x06)
		chr_toggle_p1p2(CHR_SELF)
#if VERSION >= VERSION_NTSC_1_0
		if_objective_complete(2, /*goto*/ 0x0f)
#endif
		if_chr_in_room(CHR_P1P2, 0x00, 0x0029, /*goto*/ 0x31)
	endloop(0x06)

	label(0x31)
	speak(CHR_P1P2, L_AZT_012, MP3_03CE, CHANNEL_6, COLOR_09_BLUE) // "The jamming... It's coming from that ship."
#if VERSION >= VERSION_NTSC_1_0
	label(0x0f)
#endif
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func1006_msg_elvisbeable[] = {
	beginloop(0x06)
		chr_toggle_p1p2(CHR_SELF)
		if_chr_distance_to_pad_lt(CHR_P1P2, 1000, PAD_AZT_0105, /*goto*/ 0x31)
	endloop(0x06)

	label(0x31)
	speak(CHR_P1P2, L_AZT_013, MP3_03CF, CHANNEL_6, COLOR_09_BLUE) // "Elvis... He'll be able to protect the President."
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

#define init_path(pathid, function) \
	set_chr_dodge_rating(2, 10) \
	set_accuracy(16) \
	set_reaction_speed(55) \
	set_chr_maxdamage(CHR_SELF, 60) \
	add_health_or_armor(0) \
	set_recovery_speed(30) \
	set_shield(0) \
	set_returnlist(CHR_SELF, function) \
	assign_path(pathid) \
	start_patrol \
	set_ailist(CHR_SELF, GAILIST_UNALERTED_0004)

u8 func0408_start_path00[] = {
	init_path(0, 0x0408)
	endlist
};

u8 func0409_start_path01[] = {
	init_path(1, 0x0409)
	endlist
};

u8 func040a_start_path02[] = {
	init_path(2, 0x040a)
	endlist
};

u8 func040b_start_path03[] = {
	init_path(3, 0x040b)
	endlist
};

u8 func040c_start_path04[] = {
	init_path(4, 0x040c)
	endlist
};

u8 func040d_start_path05[] = {
	init_path(5, 0x040d)
	endlist
};

u8 func040e_start_path06[] = {
	init_path(6, 0x040e)
	endlist
};

u8 func040f_start_path07[] = {
	init_path(7, 0x040f)
	endlist
};

u8 func0410_start_path08[] = {
	init_path(8, 0x0410)
	endlist
};

u8 func0411_start_path09[] = {
	init_path(9, 0x0411)
	endlist
};

u8 func0412_start_path10[] = {
	init_path(10, 0x0412)
	endlist
};

u8 func0413_start_path11[] = {
	init_path(11, 0x0413)
	endlist
};

/**
 * This function is unfinished. Target labels don't exist.
 *
 * Looks like it was intended to be a spawning function.
 */
u8 unregistered_function1[] = {
	label(0x66)
	restart_timer

	beginloop(0x67)
		dprint 'T','I','M','E','\n',0,
		if_timer_lt(1800, /*goto*/ 0x98)
		label(0x31)
		dprint 'S','Q','U','A','D','\n',0,
		if_num_chrs_in_squadron_gt(1, 0x0f, /*goto*/ 0x98)
		call_rng
		if_rand_gt(64, /*goto*/ 0x69)
		if_rand_gt(128, /*goto*/ 0x6a)
		if_rand_gt(196, /*goto*/ 0x6b)
		label(0x98)
	endloop(0x67)

	label(0x68)
	yield
	rebuild_teams
	rebuild_squadrons
	goto_first(0x66)

	endlist
};

u8 func0415_unused[] = {
	set_chr_dodge_rating(2, 10)
	set_accuracy(16)
	set_reaction_speed(55)
	set_chr_maxdamage(CHR_SELF, 60)
	add_health_or_armor(0)
	set_recovery_speed(30)
	set_shield(0)
	try_equip_weapon(MODEL_CHRAVENGER, WEAPON_K7AVENGER, 0x00000000, /*goto*/ 0x08)
	label(0x08)
	set_chr_team(CHR_SELF, TEAM_ENEMY)
	set_self_flag_bankx(CHRFLAG0_SKIPSAFETYCHECKS, BANK_0)
	set_squadron(SQUADRON_0F)
	rebuild_teams
	rebuild_squadrons
	set_ailist(CHR_SELF, GAILIST_SEARCH_FOR_PLAYER)
	endlist
};

u8 func100c_spawn_dd_guards[] = {
	label(0x66)
	restart_timer

	beginloop(0x67)
		if_stage_flag_eq(STAGEFLAG_OUTRO_STARTED, TRUE, /*goto*/ 0x0f)
		if_stage_flag_eq(STAGEFLAG_ELVIS_GAVE_PROXYMINE, TRUE, /*goto*/ 0x31)
		if_objective_complete(0, /*goto*/ 0x31)
		if_objective_complete(1, /*goto*/ 0x31)
		if_objective_complete(2, /*goto*/ 0x31)
		if_objective_complete(3, /*goto*/ 0x31)
		if_objective_complete(4, /*goto*/ 0x31)
	endloop(0x67)

	label(0x31)
	dprint 'T','I','M','E','\n',0,
	if_timer_lt(3600, /*goto*/ 0x98)
	label(0x31)
	dprint 'S','Q','U','A','D','\n',0,
	if_num_chrs_in_squadron_gt(1, 0x0e, /*goto*/ 0x98)
	call_rng
	if_rand_gt(64, /*goto*/ 0x69)
	if_rand_gt(128, /*goto*/ 0x6a)
	if_rand_gt(196, /*goto*/ 0x6b)

	// 1
	if_stage_flag_eq(STAGEFLAG_OUTRO_STARTED, TRUE, /*goto*/ 0x0f)
	try_spawn_chr_at_pad(BODY_DD_GUARD, HEAD_RANDOM, PAD_AZT_0126, AILIST_SPAWNED_GUARD, SPAWNFLAG_BASICGUARD, /*goto*/ 0x68)
	goto_next(0x98)

	// 2
	label(0x69)
	if_stage_flag_eq(STAGEFLAG_OUTRO_STARTED, TRUE, /*goto*/ 0x0f)
	try_spawn_chr_at_pad(BODY_DD_GUARD, HEAD_RANDOM, PAD_AZT_00E5, AILIST_SPAWNED_GUARD, SPAWNFLAG_BASICGUARD, /*goto*/ 0x68)
	goto_next(0x98)

	// 3
	label(0x6a)
	if_stage_flag_eq(STAGEFLAG_OUTRO_STARTED, TRUE, /*goto*/ 0x0f)
	try_spawn_chr_at_pad(BODY_DD_GUARD, HEAD_RANDOM, PAD_AZT_0130, AILIST_SPAWNED_GUARD, SPAWNFLAG_BASICGUARD, /*goto*/ 0x68)
	goto_next(0x98)

	// 4
	label(0x6b)
	if_stage_flag_eq(STAGEFLAG_OUTRO_STARTED, TRUE, /*goto*/ 0x0f)
	try_spawn_chr_at_pad(BODY_DD_GUARD, HEAD_RANDOM, PAD_AZT_00FD, AILIST_SPAWNED_GUARD, SPAWNFLAG_BASICGUARD, /*goto*/ 0x68)
	goto_next(0x98)

	// Spawn failed
	label(0x98)
	goto_first(0x67)

	// Spawn worked
	label(0x68)
	if_stage_flag_eq(STAGEFLAG_OUTRO_STARTED, TRUE, /*goto*/ 0x0f)
	yield
	rebuild_teams
	rebuild_squadrons
	goto_first(0x66)

	label(0x0f)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func0416_spawned_guard[] = {
	set_chr_dodge_rating(2, 10)
	set_accuracy(16)
	set_reaction_speed(55)
	set_chr_maxdamage(CHR_SELF, 60)
	add_health_or_armor(0)
	set_recovery_speed(30)
	set_shield(0)
	try_equip_weapon(MODEL_CHRAVENGER, WEAPON_K7AVENGER, 0x00000000, /*goto*/ 0x08)
	label(0x08)
	set_chr_team(CHR_SELF, TEAM_ENEMY)
	set_self_flag_bankx(CHRFLAG0_SKIPSAFETYCHECKS, BANK_0)
	set_self_flag_bankx(CHRFLAG0_AIVSAI, BANK_0)
	set_squadron(SQUADRON_0E)
	rebuild_teams
	rebuild_squadrons
	// Pad is next to UFO
	run_to_pad(PAD_AZT_0105)
	set_returnlist(CHR_SELF, GAILIST_UNALERTED)
	set_ailist(CHR_SELF, GAILIST_UNALERTED)
	endlist
};

u8 func1008_escapepod[] = {
	beginloop(0x06)
		chr_toggle_p1p2(CHR_SELF)
		if_object_in_good_condition(OBJ_ESCAPEPOD, /*goto*/ 0x31)

		// Pod destroyed
		mute_channel(CHANNEL_0)
		show_hudmsg(CHR_BOND, L_AZT_015) // "Critical mission object has been destroyed."
		set_stage_flag(STAGEFLAG_ESCAPEPOD_DESTROYED)
		set_ailist(CHR_SELF, GAILIST_IDLE)

		// Pod healthy
		label(0x31)
		if_stage_flag_eq(STAGEFLAG_BEACON_ACTIVATED, TRUE, /*goto*/ 0x08)
		if_chr_activated_object(CHR_P1P2, OBJ_ESCAPEPOD, /*goto*/ 0x31)
		label(0x08)
		reloop(0x06)

		label(0x31)
		assign_sound(SFX_8115, CHANNEL_0)
		play_repeating_sound_from_object(CHANNEL_0, OBJ_ESCAPEPOD, 1, 800, 1600)
		show_hudmsg(CHR_P1P2, L_AZT_014) // "Distress beacon has been activated."
		set_stage_flag(STAGEFLAG_BEACON_ACTIVATED)
	endloop(0x06)

	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func1009_check_shuttle_destroyed[] = {
	yield
	yield
	yield
	yield
	yield

	beginloop(0x06)
		if_object_in_good_condition(OBJ_SKEDAR_SHUTTLE, /*goto*/ 0x31)
		show_hudmsg(CHR_BOND, L_AZT_021) // "Jamming device has been shut down."
		set_stage_flag(STAGEFLAG_SKEDAR_SHUTTLE_DESTROYED)
		set_ailist(CHR_SELF, GAILIST_IDLE)
		label(0x31)
	endloop(0x06)

	endlist
};

u8 func100a_check_president_dead[] = {
	beginloop(0x06)
		if_chr_death_animation_finished(CHR_PRESIDENT, /*goto*/ 0x31)
		if_chr_dead(CHR_PRESIDENT, /*goto*/ 0x31)
		if_chr_knockedout(CHR_PRESIDENT, /*goto*/ 0x31)
	endloop(0x06)

	label(0x31)
	show_hudmsg(CHR_BOND, L_AZT_022) // "President has been killed."
	set_stage_flag(STAGEFLAG_PRESIDENT_DEAD)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func100b_check_clone_dead[] = {
	beginloop(0x06)
		if_chr_death_animation_finished(CHR_PRES_CLONE, /*goto*/ 0x31)
		if_chr_dead(CHR_PRES_CLONE, /*goto*/ 0x31)
		if_chr_knockedout(CHR_PRES_CLONE, /*goto*/ 0x31)
	endloop(0x06)

	label(0x31)
	show_hudmsg(CHR_BOND, L_AZT_023) // "Presidential clone has been eliminated."
	set_stage_flag(STAGEFLAG_CLONE_DEAD)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func0403_init_elvis[] = {
	set_shield(100)
	set_chr_hiddenflag(CHR_SELF, CHRHFLAG_INFINITESHIELD)
	set_self_chrflag(CHRCFLAG_INVINCIBLE)
	set_accuracy(100)
	set_reaction_speed(100)
	add_health_or_armor(1000)
	set_chr_maxdamage(CHR_SELF, 1000)
	set_self_chrflag(CHRCFLAG_RUNFASTER)
	assign_path(12)
	start_patrol
	set_ailist(CHR_SELF, AILIST_ELVIS)
	endlist
};

u8 func0404_elvis[] = {
	set_shotlist(AILIST_ELVIS)
	label(0x04)
	restart_timer

	beginloop(0x06)
		if_chr_idle(/*goto*/ 0x31)
		if_patrolling(/*goto*/ 0x31)
		restart_timer
		start_patrol
		label(0x31)
		dprint 'G','O',' ','T','O',' ','P','A','D','\n',0,
		set_target_chr(CHR_BOND)
		set_chrpreset(CHR_BOND)
		if_stage_flag_eq(STAGEFLAG_ELVIS_GAVE_PROXYMINE, TRUE, /*goto*/ 0x31)
		if_objective_complete(0, /*goto*/ 0x31)
		if_objective_complete(1, /*goto*/ 0x31)
		if_objective_complete(2, /*goto*/ 0x31)
		if_objective_complete(3, /*goto*/ 0x31)
		if_objective_complete(4, /*goto*/ 0x31)
		if_los_to_target(/*goto*/ 0xa5)
		set_target_chr(CHR_COOP)
		set_chrpreset(CHR_COOP)
		if_los_to_target(/*goto*/ 0xa5)
		label(0x31)
		if_enemy_distance_lt_and_los(2540, /*goto*/ 0x0a)
		if_timer_gt(600, /*goto*/ 0x0b)
	endloop(0x06)

	// 10 seconds passed
	label(0x0b)
	call_rng
	if_rand_gt(128, /*goto*/ 0x31)

	// 50% chance of doing look around animation
	call_rng
	if_rand_lt(64, /*goto*/ 0x99)
	if_rand_lt(128, /*goto*/ 0x9a)
	if_rand_lt(196, /*goto*/ 0x9b)

	set_self_flag_bankx(CHRFLAG1_DONE_SEARCH_ANIM, BANK_1)
	chr_do_animation(ANIM_LOOK_AROUND_025B, 0, -1, CHRANIMFLAG_SLOWUPDATE, 10, CHR_SELF, 2)
	goto_next(0x31)

	label(0x99)
	chr_do_animation(ANIM_LOOK_AROUND_025C, 0, -1, CHRANIMFLAG_SLOWUPDATE, 10, CHR_SELF, 2)
	goto_next(0x31)

	label(0x9a)
	chr_do_animation(ANIM_LOOK_AROUND_025D, 0, -1, CHRANIMFLAG_SLOWUPDATE, 10, CHR_SELF, 2)
	goto_next(0x31)

	label(0x9b)
	chr_do_animation(ANIM_LOOK_AROUND_025E, 0, -1, CHRANIMFLAG_SLOWUPDATE, 10, CHR_SELF, 2)

	label(0x31)
	goto_first(0x04)

	// Detected enemy
	label(0x0a)
	dprint 'D','E','T','E','C','T','E','D','\n',0,
	set_returnlist(CHR_SELF, AILIST_INIT_ELVIS)
	set_shotlist(AILIST_INIT_ELVIS)
	set_ailist(CHR_SELF, GAILIST_COMBAT_WITH_TARGET)

	// Sees player
	label(0xa5)
	set_target_chr(CHR_PRESET)
	try_run_to_target(/*goto*/ 0x12)

	beginloop(0x12)
		dprint 'G','O',' ','T','O','W','A','R','D','S','\n',0,
		if_distance_to_target_lt(300, /*goto*/ 0x13)
		if_timer_gt(180, /*goto*/ 0x08)
	endloop(0x12)

	// Running towards player for 3 seconds - check if can still see player
	label(0x08)
	if_los_to_target(/*goto*/ 0x31)
	goto_first(0x04)

	label(0x31)
	goto_first(0xa5)

	// Close to player
	label(0x13)
	do_preset_animation(PRESETANIM_TALKRANDOM)
	speak(CHR_TARGET, L_AZT_031, MP3_02E2, CHANNEL_6, COLOR_04_ORANGE) // "Take this; you should find it useful!"
	give_object_to_chr(OBJ_PROXYMINE, CHR_TARGET)

	beginloop(0x14)
		if_sound_finished(CHANNEL_6, /*goto*/ 0x31)
	endloop(0x14)

	label(0x31)
	stop_chr
	set_stage_flag(STAGEFLAG_ELVIS_GAVE_PROXYMINE)
	goto_first(0x04)

	endlist
};

u8 func0405_unused[] = {
	jog_to_pad(PAD_AZT_0107)
	beginloop(0x06)
	endloop(0x06)

	endlist
};

u8 func0417_init_robot[] = {
	set_accuracy(40)
	set_self_chrflag(CHRCFLAG_FORCEAUTOAIM)
	set_chr_maxdamage(CHR_SELF, 250)
	set_ailist(CHR_SELF, AILIST_ROBOT)
	endlist
};

u8 func0418_robot[] = {
	set_shotlist(AILIST_ROBOT)
	label(0x66)
	set_self_chrflag(CHRCFLAG_NEVERSLEEP)
	if_chr_dead(CHR_SELF, /*goto*/ 0x11)
	if_chr_death_animation_finished(CHR_SELF, /*goto*/ 0x11)
	if_chr_knockedout(CHR_SELF, /*goto*/ 0x08)
	goto_next(0x04)
	label(0x08)
	yield
	damage_chr(CHR_SELF, WEAPON_SUPERDRAGON)
	goto_first(0x66)

	beginloop(0x04)
		dprint 'P','A','R','T',' ','1','\n',0,
		chr_toggle_p1p2(CHR_SELF)
		set_target_chr(CHR_P1P2)
		if_alertness(99, OPERATOR_GREATER_THAN, /*goto*/ 0x0d)
		if_can_see_target(/*goto*/ 0x0d)
		call_rng
		if_rand_gt(5, /*goto*/ 0x31)
		if_sound_finished(CHANNEL_5, /*goto*/ 0x08)
		goto_next(0x31)

		// Make random noise
		label(0x08)
		call_rng
		if_rand_lt(86, /*goto*/ 0x0b)
		if_rand_lt(172, /*goto*/ 0x0c)
		assign_sound(SFX_046A, CHANNEL_5)
		play_sound_from_entity(CHANNEL_5, CHR_SELF, 0x0bb8, 0x1770, 0x01)
		goto_next(0x31)
		label(0x0b)
		assign_sound(SFX_046B, CHANNEL_5)
		play_sound_from_entity(CHANNEL_5, CHR_SELF, 0x0bb8, 0x1770, 0x01)
		goto_next(0x31)
		label(0x0c)
		assign_sound(SFX_046C, CHANNEL_5)
		play_sound_from_entity(CHANNEL_5, CHR_SELF, 0x0bb8, 0x1770, 0x01)
		label(0x31)
	endloop(0x04)

	// Alerted
	label(0x0d)
	increase_squadron_alertness(100)
	restart_timer
	if_distance_to_target_lt(300, /*goto*/ 0x31)
	if_distance_to_target_gt(1000, /*goto*/ 0x15)
	if_can_see_target(/*goto*/ 0x13)

	// Distance > 1000 or not in sight
	label(0x15)
	try_jog_to_target(/*goto*/ 0x08)

	// Distance < 300
	label(0x31)
	stop_chr

	label(0x08)
	if_self_flag_bankx_eq(CHRFLAG0_SKIPSAFETYCHECKS, TRUE, BANK_0, /*goto*/ 0x0a)
	say_quip(CHR_BOND, 0x1f, 0xff, 0x02, 0xff, BANK_1, 0x00, 0x00)
	set_self_flag_bankx(CHRFLAG0_SKIPSAFETYCHECKS, BANK_0)

	beginloop(0x0a)
		dprint 'P','A','R','T',' ','2','\n',0,
		if_timer_gt(180, /*goto*/ 0x08)
		if_distance_to_target_gt(1000, /*goto*/ 0x15)
		dprint 'P','A','R','T',' ','2','\n',0,
		if_can_see_target(/*goto*/ 0x13)
		chr_toggle_p1p2(CHR_SELF)
		set_target_chr(CHR_P1P2)
		if_can_see_target(/*goto*/ 0x13)
		chr_toggle_p1p2(CHR_SELF)
		set_target_chr(CHR_P1P2)
		label(0x15)
	endloop(0x0a)

	// Player in sight
	label(0x13)
	set_target_chr(CHR_P1P2)
	restart_timer
	dprint 'P','A','R','T',' ','3','a','\n',0,
	try_attack_stand(ATTACKFLAG_AIMATTARGET, 0, /*goto*/ 0x0e)
	goto_first(0x04)

	beginloop(0x0e)
		if_chr_stopped(/*goto*/ 0x08)
	endloop(0x0e)

	label(0x08)
	goto_first(0x0d)

	label(0x11)
	assign_sound(MP3_ROBOT_ALERT_UNDER_ATTACK, CHANNEL_6)
	play_sound_from_entity(CHANNEL_6, CHR_SELF, 0x0bb8, 0x1770, 0x01)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

/**
 * Assigned to two stripes guards.
 */
u8 func0414_spawner[] = {
	set_self_chrflag(CHRCFLAG_CLONEABLE)

	beginloop(0x06)
		chr_toggle_p1p2(CHR_SELF)
		set_target_chr(CHR_P1P2)
		if_los_to_target(/*goto*/ 0x0a)
		// Room 0x0029 is the skedar shuttle area
		if_chr_in_room(CHR_P1P2, 0x00, 0x0029, /*goto*/ 0x0a)
		reloop(0x06)

		label(0x0a)
		dprint 'H','E','A','R','S','P','A','W','N','\n',0,
		label(0x31)
		if_never_been_onscreen(/*goto*/ 0x52)
		dprint 'N','E','V','E','R',' ','V','I','S','F','A','I','L','\n',0,
		if_los_to_target(/*goto*/ 0x0a)
	endloop(0x06)

	label(0x0a)
	set_ailist(CHR_SELF, GAILIST_ALERTED)

	label(0x52)
	dprint 'C','H','E','C','K',' ','D','U','P','E','\n',0,
	if_chr_death_animation_finished(CHR_CLONE, /*goto*/ 0x52)
	set_ailist(CHR_SELF, AILIST_SPAWNER)

	label(0x52)
	dprint 'C','R','E','A','T','E',' ','S','P','A','W','N','\n',0,
	try_spawn_clone2(CHR_SELF, GAILIST_ALERTED, 0, /*goto*/ 0x31)
	dprint 'C','R','E','A','T','E',' ','F','A','I','L','\n',0,
	set_ailist(CHR_SELF, AILIST_SPAWNER)

	label(0x31)
	yield
	set_ailist(CHR_SELF, AILIST_SPAWNER)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func0419_unused[] = {
	set_self_chrflag(CHRCFLAG_HIDDEN)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func0422_hide[] = {
	set_self_chrflag(CHRCFLAG_INVINCIBLE)
	set_self_chrflag(CHRCFLAG_UNEXPLODABLE)
	set_self_chrflag(CHRCFLAG_HIDDEN)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func041a_pres_clone[] = {
	set_self_chrflag(CHRCFLAG_FORCEAUTOAIM)
	set_self_chrflag(CHRCFLAG_RUNFASTER)

	beginloop(0x06)
		chr_toggle_p1p2(CHR_SELF)
		set_target_chr(CHR_P1P2)
		if_alertness(99, OPERATOR_GREATER_THAN, /*goto*/ 0x31)
		if_target_outside_my_yvisang(/*goto*/ 0x08)
		if_can_see_target(/*goto*/ 0x31)
		label(0x08)
	endloop(0x06)

	// Alert, or player in sight and looking at clone
	label(0x31)
	run_to_pad(PAD_AZT_002C)

	beginloop(0x0a)
		if_chr_stopped(/*goto*/ 0x31)
	endloop(0x0a)

	label(0x31)
	stop_chr

	label(0xa5)
	chr_do_animation(ANIM_COWER_0229, -1, -1, CHRANIMFLAG_SLOWUPDATE, 10, CHR_SELF, 2)

	beginloop(0x10)
		if_chr_stopped(/*goto*/ 0x31)
	endloop(0x10)

	label(0x31)
	goto_first(0xa5)

	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func041b_init_president[] = {
	set_self_chrflag(CHRCFLAG_RUNFASTER)
	set_chr_maxdamage(CHR_SELF, 300)
	set_shield(0)
	set_ailist(CHR_SELF, AILIST_PRESIDENT_WAITING)
	endlist
};

u8 func041c_president_waiting[] = {
	set_shotlist(AILIST_PRESIDENT_WAITING)
	if_chr_dead(CHR_SELF, /*goto*/ 0x08)
	if_chr_death_animation_finished(CHR_SELF, /*goto*/ 0x08)
	if_chr_knockedout(CHR_SELF, /*goto*/ 0x08)
	goto_next(0x31)

	// Dying
	label(0x08)
	set_shotlist(GAILIST_IDLE)
	set_ailist(CHR_SELF, GAILIST_IDLE)

	label(0x31)
	stop_chr
	yield

	// Wait until trigger and can see player
	beginloop(0x06)
		chr_toggle_p1p2(CHR_SELF)
		set_target_chr(CHR_P1P2)
		if_stage_flag_eq(STAGEFLAG_TRIGGER_PRESIDENT_RUNNING, TRUE, /*goto*/ 0x31)
		goto_first(0x06)

		label(0x31)
		if_los_to_target(/*goto*/ 0x31)
	endloop(0x06)

	label(0x31)
	set_shotlist(AILIST_PRESIDENT_RUNNING)
	set_ailist(CHR_SELF, AILIST_PRESIDENT_RUNNING)
	endlist
};

u8 func041d_president_running[] = {
	set_self_chrflag(CHRCFLAG_PUSHABLE)
	set_alertness(100)
	set_shotlist(AILIST_PRESIDENT_RUNNING)
	dprint 'R','E','S','T','A','R','T','\n',0,
	yield
	if_chr_dead(CHR_SELF, /*goto*/ 0x08)
	if_chr_death_animation_finished(CHR_SELF, /*goto*/ 0x08)
	if_chr_knockedout(CHR_SELF, /*goto*/ 0x08)
	goto_next(0x31)

	// Dying
	label(0x08)
	set_shotlist(GAILIST_IDLE)
	restart_timer

	beginloop(0x9c)
		dprint 'K','I','L','L','E','D','\n',0,
		if_timer_gt(15, /*goto*/ 0x08)
	endloop(0x9c)

	label(0x08)
	assign_sound(MP3_02BF, CHANNEL_6)
	play_sound_from_entity(CHANNEL_6, CHR_SELF, 0x0bb8, 0x1770, 0x01)
	set_shotlist(GAILIST_IDLE)
	set_ailist(CHR_SELF, GAILIST_IDLE)

	// Alive
	label(0x31)
	dprint 'b','4',' ','s','h','i','e','l','d',' ','c','h','e','c','k','\n',0,
	if_just_injured(CHR_SELF, /*goto*/ 0x08)
	goto_next(0x9d)

	// Injured
	label(0x08)
	restart_timer
	assign_sound(MP3_02C2, CHANNEL_6)
	play_sound_from_entity(CHANNEL_6, CHR_SELF, 0x0bb8, 0x1770, 0x01)

	beginloop(0x9e)
		dprint 'I','N','J','U','R','E','D','\n',0,
		if_num_times_shot_lt(1, /*goto*/ 0x08)
		if_timer_lt(20, /*goto*/ 0x08)
		label(0x08)
		if_chr_stopped(/*goto*/ 0x9d)
	endloop(0x9e)

	// Main logic
	label(0x9d)
	stop_chr
	restart_timer

	beginloop(0x9f)
		dprint 'W','A','I','T','\n',0,
		// Room 0x0014 = UFO area
		// Yes, checking this 5 times is unnecessary
		if_chr_in_room(CHR_SELF, 0x00, 0x0014, /*goto*/ 0xa5)
		if_chr_in_room(CHR_SELF, 0x00, 0x0014, /*goto*/ 0xa5)
		if_chr_in_room(CHR_SELF, 0x00, 0x0014, /*goto*/ 0xa5)
		if_chr_in_room(CHR_SELF, 0x00, 0x0014, /*goto*/ 0xa5)
		if_chr_in_room(CHR_SELF, 0x00, 0x0014, /*goto*/ 0xa5)
		dprint 't','a','r','g','e','t','\n',0,
		if_los_to_target(/*goto*/ 0x08)
		goto_next(0xa0)

		label(0x08)
		if_timer_gt(1250, /*goto*/ 0x31)
		if_distance_to_target_gt(200, /*goto*/ 0xa0)
	endloop(0x9f)

	// 20.8 seconds passed
	// Pointless RNG check
	label(0x31)
	call_rng
	if_rand_lt(64, /*goto*/ 0x31)
	goto_first(0x9d)
	label(0x31)
	goto_first(0x9d)

	// Sees player
	label(0x08)
	goto_first(0x9d)

	// Can't see player, or distance > 200
	label(0xa0)
	restart_timer
	label(0x31)
	if_distance_to_target_gt(300, /*goto*/ 0x31)
	try_jog_to_target(/*goto*/ 0xa1)
	label(0x31)
	try_run_to_target(/*goto*/ 0xa1)

	beginloop(0xa1)
		dprint 'F','O','L','L','O','W','\n',0,
		if_chr_in_room(CHR_SELF, 0x00, 0x0014, /*goto*/ 0xa5)
		if_chr_in_room(CHR_SELF, 0x00, 0x0014, /*goto*/ 0xa5)
		if_chr_in_room(CHR_SELF, 0x00, 0x0014, /*goto*/ 0xa5)
		if_chr_in_room(CHR_SELF, 0x00, 0x0014, /*goto*/ 0xa5)
		if_chr_in_room(CHR_SELF, 0x00, 0x0014, /*goto*/ 0xa5)
		if_distance_to_target_lt(100, /*goto*/ 0xa2)
		if_chr_stopped(/*goto*/ 0xa2)
		if_timer_gt(360, /*goto*/ 0x31)
	endloop(0xa1)

	// 6 seconds passed while running
	label(0x31)
	goto_first(0xa0)

	// Unreachable
	label(0x08)
	goto_first(0xa0)

	// Next to player
	label(0xa2)
	goto_first(0x9d)

	// Unreachable
	label(0xa3)
	try_run_to_target(/*goto*/ 0xa4)

	// Unreachable
	beginloop(0xa4)
		dprint 'R','U','N','N','F','O','\n',0,
		if_chr_in_room(CHR_SELF, 0x00, 0x0014, /*goto*/ 0xa5)
		if_chr_in_room(CHR_SELF, 0x00, 0x0014, /*goto*/ 0xa5)
		if_chr_in_room(CHR_SELF, 0x00, 0x0014, /*goto*/ 0xa5)
		if_chr_in_room(CHR_SELF, 0x00, 0x0014, /*goto*/ 0xa5)
		if_chr_in_room(CHR_SELF, 0x00, 0x0014, /*goto*/ 0xa5)
	endloop(0xa4)

	// Unreachable
	label(0xa6)
	goto_first(0x9d)

	// Jo is near UFO
	label(0xa5)
	run_to_pad(PAD_AZT_0105)

	beginloop(0x0b)
		if_chr_stopped(/*goto*/ 0x08)
	endloop(0x0b)

	label(0x08)
	stop_chr
#if VERSION >= VERSION_NTSC_1_0
	set_chr_team(CHR_SELF, TEAM_NONCOMBAT)
	rebuild_teams
	rebuild_squadrons
#endif
	if_stage_flag_eq(STAGEFLAG_PRESIDENT_RESCUED, TRUE, /*goto*/ 0x31)
	show_hudmsg(CHR_TARGET, L_AZT_025) // "President has been rescued."
	set_stage_flag(STAGEFLAG_PRESIDENT_RESCUED)
	label(0x31)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func100e_check_robots_left[] = {
	beginloop(0x06)
		if_chr_death_animation_finished(CHR_ROBOT1, /*goto*/ 0x31)
		if_chr_dead(CHR_ROBOT1, /*goto*/ 0x31)
		if_chr_knockedout(CHR_ROBOT1, /*goto*/ 0x31)
		if_chr_in_room(CHR_ROBOT1, 0x00, ROOM_AZT_004A, /*goto*/ 0x08)
		if_chr_in_room(CHR_ROBOT1, 0x00, ROOM_AZT_004B, /*goto*/ 0x08)
		if_chr_in_room(CHR_ROBOT1, 0x00, ROOM_AZT_004C, /*goto*/ 0x08)
		if_chr_in_room(CHR_ROBOT1, 0x00, ROOM_AZT_004D, /*goto*/ 0x08)
		goto_next(0x31)
		label(0x08)
		reloop(0x06)

		label(0x31)
		if_chr_death_animation_finished(CHR_ROBOT2, /*goto*/ 0x31)
		if_chr_dead(CHR_ROBOT2, /*goto*/ 0x31)
		if_chr_knockedout(CHR_ROBOT2, /*goto*/ 0x31)
		if_chr_in_room(CHR_ROBOT2, 0x00, ROOM_AZT_004A, /*goto*/ 0x08)
		if_chr_in_room(CHR_ROBOT2, 0x00, ROOM_AZT_004B, /*goto*/ 0x08)
		if_chr_in_room(CHR_ROBOT2, 0x00, ROOM_AZT_004C, /*goto*/ 0x08)
		if_chr_in_room(CHR_ROBOT2, 0x00, ROOM_AZT_004D, /*goto*/ 0x08)
		goto_next(0x31)
		label(0x08)
		reloop(0x06)

		label(0x31)
		if_chr_death_animation_finished(CHR_ROBOT3, /*goto*/ 0x31)
		if_chr_dead(CHR_ROBOT3, /*goto*/ 0x31)
		if_chr_knockedout(CHR_ROBOT3, /*goto*/ 0x31)
		if_chr_in_room(CHR_ROBOT3, 0x00, ROOM_AZT_004A, /*goto*/ 0x08)
		if_chr_in_room(CHR_ROBOT3, 0x00, ROOM_AZT_004B, /*goto*/ 0x08)
		if_chr_in_room(CHR_ROBOT3, 0x00, ROOM_AZT_004C, /*goto*/ 0x08)
		if_chr_in_room(CHR_ROBOT3, 0x00, ROOM_AZT_004D, /*goto*/ 0x08)
		goto_next(0x31)
		label(0x08)
		reloop(0x06)

		label(0x31)
		if_chr_death_animation_finished(CHR_ROBOT4, /*goto*/ 0x31)
		if_chr_dead(CHR_ROBOT4, /*goto*/ 0x31)
		if_chr_knockedout(CHR_ROBOT4, /*goto*/ 0x31)
		if_chr_in_room(CHR_ROBOT4, 0x00, ROOM_AZT_004A, /*goto*/ 0x08)
		if_chr_in_room(CHR_ROBOT4, 0x00, ROOM_AZT_004B, /*goto*/ 0x08)
		if_chr_in_room(CHR_ROBOT4, 0x00, ROOM_AZT_004C, /*goto*/ 0x08)
		if_chr_in_room(CHR_ROBOT4, 0x00, ROOM_AZT_004D, /*goto*/ 0x08)
		goto_next(0x31)
		label(0x08)
		reloop(0x06)

		label(0x31)
		if_stage_flag_eq(STAGEFLAG_TRENT_RUNNING, TRUE, /*goto*/ 0x31)
	goto_first(0x06)

	label(0x31)
	set_stage_flag(STAGEFLAG_TRIGGER_PRESIDENT_RUNNING)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func041e_trent_waiting[] = {
	set_accuracy(0)
	set_self_chrflag(CHRCFLAG_NOFRIENDLYFIRE)
	set_shield(100)
	set_chr_hiddenflag(CHR_SELF, CHRHFLAG_INFINITESHIELD)

	beginloop(0x06)
		chr_toggle_p1p2(CHR_SELF)
		set_target_chr(CHR_P1P2)
		if_los_to_target(/*goto*/ 0x08)
	endloop(0x06)

	label(0x08)
	restart_timer
	speak(CHR_P1P2, L_AZT_024, MP3_02CA, CHANNEL_6, COLOR_05_GREEN) // "You'll never save him now!"
	chr_do_animation(ANIM_TALKING_0231, 0, -1, CHRANIMFLAG_SLOWUPDATE, 16, CHR_SELF, 2)

	beginloop(0x0a)
		if_timer_gt(120, /*goto*/ 0x08)
	endloop(0x0a)

	label(0x08)
	set_ailist(CHR_SELF, AILIST_TRENT_SHOOTING)
	endlist
};

u8 func041f_trent_shooting[] = {
	label(0x04)
	stop_chr

	beginloop(0x06)
		chr_toggle_p1p2(CHR_SELF)
		set_target_chr(CHR_P1P2)
		if_chr_shield_damaged(CHR_SELF, /*goto*/ 0x31)
		if_can_see_target(/*goto*/ 0x08)
	endloop(0x06)

	label(0x31)
	set_ailist(CHR_SELF, AILIST_TRENT_RUNNING)

	label(0x08)
	label(0xa8)
	try_attack_stand(ATTACKFLAG_AIMATTARGET | ATTACKFLAG_AIMONLY, 0, /*goto*/ 0xa7)
	label(0xa7)
	say_quip(CHR_BOND, QUIP_ATTACK1, 0x19, 0x02, 0x01, BANK_0, 0x00, 0x00)
	try_modify_attack(ATTACKFLAG_AIMATTARGET, 0, /*goto*/ 0x0a)
	goto_next(0x31)

	// Shoot worked
	beginloop(0x0a)
		if_chr_stopped(/*goto*/ 0x08)
	endloop(0x0a)

	label(0x08)
	goto_next(0x0b)

	// Unreachable
	if_chr_dead(CHR_TARGET, /*goto*/ 0x0b)
	goto_first(0x04)

	// Shoot failed
	label(0x31)
	goto_first(0x04)

	label(0x0b)
	restart_timer
	chr_do_animation(ANIM_TALKING_0231, 0, -1, CHRANIMFLAG_SLOWUPDATE, 16, CHR_SELF, 2)

	beginloop(0x0c)
		if_timer_gt(120, /*goto*/ 0x08)
	endloop(0x0c)

	label(0x08)
	set_ailist(CHR_SELF, AILIST_TRENT_RUNNING)
	endlist
};

u8 func0420_trent_running[] = {
	set_self_chrflag(CHRCFLAG_RUNFASTER)
	set_self_chrflag(CHRCFLAG_INVINCIBLE)
	set_stage_flag(STAGEFLAG_TRENT_RUNNING)
	restart_timer
	run_to_pad(PAD_AZT_0027)

	beginloop(0x0a)
		if_timer_gt(300, /*goto*/ 0x31)
	endloop(0x0a)

	label(0x31)
	chr_toggle_p1p2(CHR_SELF)
	set_target_chr(CHR_P1P2)
	if_los_to_target(/*goto*/ 0x31)
	goto_next(0x08)

	label(0x31)
	if_chr_stopped(/*goto*/ 0x08)
	goto_first(0x0a)

	// Player not in sight, or Trent has reached his destination
	label(0x08)
	if_nearly_in_targets_sight(30, /*goto*/ 0x31)
	goto_next(0x08)

	label(0x31)
	goto_first(0x0a)

	// Player definitely not in sight
	label(0x08)
	set_self_chrflag(CHRCFLAG_HIDDEN)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func100f_check_end_level[] = {
	beginloop(0x0a)
		if_all_objectives_complete(/*goto*/ 0x08)
	endloop(0x0a)

	label(0x08)
	restart_timer

	beginloop(0x0b)
		if_timer_gt(120, /*goto*/ 0x31)
	endloop(0x0b)

	label(0x31)
	if_chr_death_animation_finished(CHR_BOND, /*goto*/ 0x31)
	if_chr_dead(CHR_BOND, /*goto*/ 0x31)
	if_chr_knockedout(CHR_BOND, /*goto*/ 0x31)
	goto_next(0x08)

	label(0x31)
	if_chr_death_animation_finished(CHR_COOP, /*goto*/ 0x31)
	if_chr_dead(CHR_COOP, /*goto*/ 0x31)
	if_chr_knockedout(CHR_COOP, /*goto*/ 0x31)

	// Jo or Velvet alive
	label(0x08)
	if_chr_death_animation_finished(CHR_PRESIDENT, /*goto*/ 0x32)
	if_chr_dead(CHR_PRESIDENT, /*goto*/ 0x32)
	if_chr_knockedout(CHR_PRESIDENT, /*goto*/ 0x32)
	set_ailist(CHR_PRESIDENT, GAILIST_STOP_AND_IDLE)

	if_chr_death_animation_finished(CHR_BOND, /*goto*/ 0x31)
	if_chr_dead(CHR_BOND, /*goto*/ 0x31)
	if_chr_knockedout(CHR_BOND, /*goto*/ 0x31)
	goto_next(0x08)

	// Both players dead
	label(0x31)
	if_chr_death_animation_finished(CHR_COOP, /*goto*/ 0x31)
	if_chr_dead(CHR_COOP, /*goto*/ 0x31)
	if_chr_knockedout(CHR_COOP, /*goto*/ 0x31)
	goto_next(0x08)

	label(0x31)
	end_level
	set_ailist(CHR_SELF, GAILIST_IDLE)

	// Mission complete
	label(0x08)
	set_invincible(CHR_BOND)
	set_ailist(CHR_SELF, AILIST_OUTRO)

	// President dead
	label(0x32)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

/**
 * Assigned to 4 stripes and 2 blondes near the starting area.
 */
u8 func0421_starting_area_guard[] = {
	label(0x0a)
	set_returnlist(CHR_SELF, GAILIST_UNALERTED)
	set_ailist(CHR_SELF, GAILIST_SEARCH_FOR_PLAYER)
	endlist
};

u8 func1010_set_cave_lights[] = {
	yield
	set_lights_state(ROOM_AZT_0064, LIGHTOP_SET, 6, 0, 0)
	set_lights_state(ROOM_AZT_0063, LIGHTOP_SET, 6, 0, 0)
	set_lights_state(ROOM_AZT_0062, LIGHTOP_SET, 6, 0, 0)
	set_lights_state(ROOM_AZT_0061, LIGHTOP_SET, 6, 0, 0)
	set_lights_state(ROOM_AZT_0060, LIGHTOP_SET, 6, 0, 0)
	set_lights_state(ROOM_AZT_005F, LIGHTOP_SET, 6, 0, 0)
	set_lights_state(ROOM_AZT_005E, LIGHTOP_SET, 6, 0, 0)
	set_lights_state(ROOM_AZT_005D, LIGHTOP_SET, 6, 0, 0)
	set_lights_state(ROOM_AZT_005C, LIGHTOP_SET, 6, 0, 0)
	set_lights_state(ROOM_AZT_005B, LIGHTOP_SET, 6, 0, 0)
	set_lights_state(ROOM_AZT_005A, LIGHTOP_SET, 6, 0, 0)
	set_lights_state(ROOM_AZT_0059, LIGHTOP_SET, 6, 0, 0)
	set_lights_state(ROOM_AZT_0053, LIGHTOP_SET, 6, 0, 0)
	set_lights_state(ROOM_AZT_0058, LIGHTOP_SET, 6, 0, 0)
	set_lights_state(ROOM_AZT_0056, LIGHTOP_SET, 6, 0, 0)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func1012_give_medicalscanner[] = {
	yield
	if_difficulty_gt(DIFF_A, /*goto*/ 0x31)
	give_object_to_chr(OBJ_MEDICALSCANNER, CHR_BOND)
	label(0x31)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func1013_setup_rtracker[] = {
	yield
	set_object_flag3(OBJ_PROXYMINE, OBJFLAG3_RTRACKED_BLUE)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func1016_hide_hoverbike[] = {
	yield
	if_savefile_flag_is_set(GAMEFILEFLAG_CRASHSITE_BIKE, /*goto*/ 0x08)
	disable_object(OBJ_HOVERBIKE)
	label(0x08)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func1014_setup_skedar_shuttle[] = {
	yield
	enable_object(OBJ_SKEDAR_SHUTTLE)
	set_object_flag3(OBJ_SKEDAR_SHUTTLE, OBJFLAG3_00000010)
	object_set_modelpart_visible(OBJ_SKEDAR_SHUTTLE, MODELPART_SKSHUTTLE_GANGWAY, FALSE)
	object_do_animation(ANIM_0486, OBJ_SKEDAR_SHUTTLE, 0x01, 0xffff)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func1415_setup_environment[] = {
	yield
	configure_environment(ROOM_AZT_0001, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_0001, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_0002, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_0002, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_0003, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_0004, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_0005, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_0006, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_0006, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_0008, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_0009, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_0009, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_000A, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_000A, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_000B, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_000B, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_000C, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_000C, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_000D, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_000D, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_000E, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_000E, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_000F, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_000F, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_0010, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_0010, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_0011, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_0011, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_0012, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_0012, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_0013, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_0013, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_0014, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_0014, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_0015, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_0015, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_0016, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_0016, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_0018, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_0018, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_0019, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_0019, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_001A, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_001B, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_001B, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_001C, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_001C, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_001D, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_001E, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_001E, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_0025, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_0025, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_0026, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_0026, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_0027, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_0027, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_0028, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_0028, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_0029, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_0029, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_002A, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_002A, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_002B, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_002B, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_002C, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_002C, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_002E, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_002E, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_002F, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_002F, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_0030, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_0030, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_0031, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_0031, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_0032, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_0032, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_0033, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_0033, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_0035, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_0035, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_0036, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_0036, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_0038, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_0038, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_003A, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_003A, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_003B, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_003B, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_003C, AIENVCMD_ROOM_SETAMBIENT, TRUE)
#if VERSION >= VERSION_NTSC_1_0
	configure_environment(ROOM_AZT_003C, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
#else
	configure_environment(ROOM_AZT_003C_2, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_003C_2, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
#endif
	configure_environment(ROOM_AZT_003D, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_003D, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_003E, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	configure_environment(ROOM_AZT_003F, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_0045, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_0065, AIENVCMD_ROOM_SETAMBIENT, TRUE)
	configure_environment(ROOM_AZT_0065, AIENVCMD_ROOM_SETOUTDOORS, TRUE)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

struct ailist ailists[] = {
	{ func1400_setup_counterop,         0x1400 },
	{ func1001_objectives_failed_msg,   0x1001 },
	{ func1002_intro,                   0x1002 },
	{ func1003_msg_therestheescapepod,  0x1003 },
	{ func1004_msg_maybetheresabeacon,  0x1004 },
	{ func1005_msg_thejamming,          0x1005 },
	{ func1006_msg_elvisbeable,         0x1006 },
	{ func1008_escapepod,               0x1008 },
	{ func1009_check_shuttle_destroyed, 0x1009 },
	{ func100a_check_president_dead,    0x100a },
	{ func100b_check_clone_dead,        0x100b },
	{ func100c_spawn_dd_guards,         0x100c },
	{ func100e_check_robots_left,       0x100e },
	{ func100f_check_end_level,         0x100f },
	{ func1010_set_cave_lights,         0x1010 },
	{ func1011_setup_snow,              0x1011 },
	{ func1012_give_medicalscanner,     0x1012 },
	{ func1013_setup_rtracker,          0x1013 },
	{ func1014_setup_skedar_shuttle,    0x1014 },
	{ func1415_setup_environment,       0x1415 },
	{ func1016_hide_hoverbike,          0x1016 },
	{ func1002_intro,                   0x0401 },
	{ func0402_outro,                   0x0402 },
	{ func0403_init_elvis,              0x0403 },
	{ func0404_elvis,                   0x0404 },
	{ func0405_unused,                  0x0405 },
	{ func1002_intro,                   0x0c00 },
	{ func0402_outro_from_menu,         0x0c01 },
	{ func0406_init_stripes,            0x0406 },
	{ func0407_init_blonde,             0x0407 },
	{ func0408_start_path00,            0x0408 },
	{ func0409_start_path01,            0x0409 },
	{ func040a_start_path02,            0x040a },
	{ func040b_start_path03,            0x040b },
	{ func040c_start_path04,            0x040c },
	{ func040d_start_path05,            0x040d },
	{ func040e_start_path06,            0x040e },
	{ func040f_start_path07,            0x040f },
	{ func0410_start_path08,            0x0410 },
	{ func0411_start_path09,            0x0411 },
	{ func0412_start_path10,            0x0412 },
	{ func0413_start_path11,            0x0413 },
	{ func0414_spawner,                 0x0414 },
	{ func0415_unused,                  0x0415 },
	{ func0416_spawned_guard,           0x0416 },
	{ func0417_init_robot,              0x0417 },
	{ func0418_robot,                   0x0418 },
	{ func0419_unused,                  0x0419 },
	{ func041a_pres_clone,              0x041a },
	{ func041c_president_waiting,       0x041c },
	{ func041b_init_president,          0x041b },
	{ func041d_president_running,       0x041d },
	{ func041e_trent_waiting,           0x041e },
	{ func041f_trent_shooting,          0x041f },
	{ func0420_trent_running,           0x0420 },
	{ func0421_starting_area_guard,     0x0421 },
	{ func0422_hide,                    0x0422 },
	{ NULL, 0 },
};
